allora c'è un timer che regola i collegamenti dei client
codice:
If tcplisten.Pending Then
client = tcplisten.AcceptTcpClient
netstrm = client.GetStream
Ricevi.Enabled = True
Dim IPAddress As New IPAddress(Dns.GetHostByName(Dns.GetHostName).AddressList(0).Address)
Dim strIPAddress As String = IPAddress.ToString
Dim bytes As Byte() = System.Text.Encoding.ASCII.GetBytes("Connesso al server: " & strIPAddress & " Tuo IP: ")
netstrm.Write(bytes, 0, bytes.Length)
netstrm.Flush()
End If
e un altro per ricevere i messaggi
codice:
If netstrm.DataAvailable = True Then
Dim stringar As String
Dim bytes(client.ReceiveBufferSize()) As Byte
netstrm.Read(bytes, 0, bytes.Length)
stringar += System.Text.Encoding.ASCII.GetString(bytes)
TextBox1.Text += stringar & vbCrLf
End If
codice:
Private tcplisten As New TcpListener(1100)
Dim client As New TcpClient()
Dim netstrm As NetworkStream
questo sn le dichiarazioni
per quanto riguarda il client sto provando con telnet ma ho ank provato con lo stesso esito cn un client realizzato da me sempre con la classe tcpclient