Simple example TCPClient / Listener ("hello world")

All I'm looking for is a simple TCPClient / Listener ("hello world") example. I'm a newbie, and Microsoft TCPClient / Listener class examples are not what I'm looking for. All I'm looking for is for TCPClient to send the message "Hello world" and TCPListener to receive the message and return the message "I received your hi-message of the world"?

A little help would be great. All I have is sending TCPClient "Hello World". Will this work?

Dim port As Int32 = 13000 Dim client As New TcpClient("192.168.0.XXX", port) ' Translate the passed message into ASCII and store it as a Byte array. Dim data As [Byte]() = System.Text.Encoding.ASCII.GetBytes("Hello World") ' Get a client stream for reading and writing. ' Stream stream = client.GetStream(); Dim stream As NetworkStream = client.GetStream() ' Send the message to the connected TcpServer. stream.Write(data, 0, data.Length) 
+7
source share
1 answer

These two tutorials should show you how to do this with a minimum minimum. The first one is more aimed at what you want, I think.

Try the following: http://www.nullskull.com/articles/20020323.asp

Or this: http://www.codeproject.com/Articles/38914/A-TCP-IP-Chat-Program

+5
source

Source: https://habr.com/ru/post/955435/


All Articles