Server-side:
Port for listening ports
Byte[] BS generally declares a larger array to receive
int Ilen is the received packet length, according to it from byte[] BS intercept is good
IPEndPoint Localendpoint =NewIPEndPoint (Ipaddress.parse ("127.0.0.1"), port); Socket Listener=Newsockets (AddressFamily.InterNetwork, SocketType.Stream, protocoltype.tcp); listener. Bind (localendpoint); listener. Listen ( -); while(true) {Socket sock=Listener. Accept (); byte[] bs =New byte[1024x768*1024x768]; intIlen =sock. Receive (BS);}
Client:
It's easy to send data after a successful connection.
New IPEndPoint (Ipaddress.parse (IP), iport); // IP and Ports New sockets (AddressFamily.InterNetwork, SocketType.Stream, protocoltype.tcp); sock. Connect (IPEP); sock. Send (Sendbytes, Sendbytes.length, socketflags.none); // Send Message
TCP Sockets for C # (synchronous mode)