Under VB.NET, it is generally sent in the local area network. The following is a simple implementation instance of my own point, just throwing brick, please give:
The following is the process of sending information:
Public Sub SendMessage (ByVal IP As String, ByVal SendMsg As String) If IP <> "" Then Dim tcpc As New System.Net.Sockets.TcpClient (IP, 5656) Dim tcpStream As Net.Sockets.NetworkStream = tcpc.GetStream Dim ReqStream as new o.streamwriter (tcpstream) ReqStream.write (Sendmsg) ReqStream.flush () TcpStream.close () Tcpc.close () end if End Sub
The following is listening and display code
DIM TH As threading.thread Dim Tcpl as system.net.sockets.tcplistener
This is the listening process private sub mylisten () DIM ipaddress as system.net.Ipaddress = system.net.dns.resolve (system.net.dns.getHostName) .addresslist (0) TCPL = new system.net.sockets.tcplistener (ipaddress, 5656) TCPL.Start () while true dims.s system.net.sockets.sockt = tcpl.acceptsocket () DIM MyBuffer (1024) AS BYTE DIM I AS INTEGER I = S.Receive (MyBuffer) IF i> 0 Then Me.Show () DIM LSTREC AS STRING LSTREC = System.Text.Encoding.utf8.getstring (MyBuffer) me.label1.text = lstrrec end if End while end SUB
In the form is opened, you start a listening thread:
Private Sub MainForm_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load th = New System.Threading.Thread (New System.Threading.ThreadStart (AddressOf MyListen)) th.Start ()
End Sub
So can only be implemented in the local area, as for the wall, then research together with colleagues