Use socket programming.
1. Socket library is required. You need to know the version of the applied socket library, which is represented by the word type: makeword. After loading, check whether the requested version is obtained.
2. Create a socket. Socket socket struct.
3. Bind the socket object to the sockaddr socket address. In TCP/IP programming, sockaddr_in can be used to replace sockaddr (both represent the address space ). Sockaddr_in includes sin_family: address family. If the IP address is always af_inet, sin_port is the port address in the byte sequence of the network, and sin_addr is the Host IP address and the in_addr structure.
In sockaddr_in, the network is in byte order. Generally, port addresses such as 6000 and IP address inaddr_any are in the host byte order. To convert the port address, htonl () htons () is used ()
4. Request connect from another socket, accept the client's connection request accept, and return the socket type
5. send messages to connected sockets send messages to unconnected sockets sendto
6. Accept information Recv from connected socket and accept information recvfrom () from unconnected socket ()
In addition, note: the standard input and output header file stdio. h
Contains the socket library, header file: winsock2.h