Linux socket note constants & predefined INADDR_ANY and other INADDR_ANY: all address definitions: # include <netinet/in. h> INADDR_ANY indicates the address 0.0.0.0. In fact, this address indicates an uncertain address, "all addresses", or "any address ". Generally, it is defined as 0 in each system. Www.2cto.com/* Address to accept any incoming messages. */# define INADDR_ANY (in_addr_t) 0x00000000) serveraddr. sin_addr.s_addr = INADDR_ANY; char * local_addr = "0.0.0.0"; serveraddr. sin_addr.s_addr = inet_addr (local_addr); // converts inet_addr to several bytes in the network's byte order. Conversion Function: · htonl (): convert 32-bit values from the host byte to the network byte order · htons (): Convert 16-bit values from the host byte order to the network byte order · ntohl (): convert 32-bit values from the network byte to the host byte order · ntohs (): Convert 16-bit values from the network byte order to the host byte order FD_ZERO (fd_set * set) ---- clears a file descriptor set; FD_SET (int fd, fd_set * set) ---- Add a file descriptor to the file descriptor set; FD_CLR (int fd, fd_set * set) ---- clear a file descriptor from the file descriptor set; FD_ISSET (int fd, fd_set * set) ---- try to determine whether the file descriptor is set. Socket parameters. Www.2cto.com int socket (int domain, int type, int protocol); In the parameter table, the domain specifies the address type, which is commonly used: PF_INET, AF_INET: Ipv4 network protocol; PF_INET6, AF_INET6: Ipv6 network protocol. The type parameter is used to set the protocol type of communication. The possible values are as follows: SOCK_STREAM: Provides connection-oriented stable data transmission, that is, TCP protocol. OOB: You must use connect () to establish the connection status before transmitting all data. Www.2cto.com SOCK_DGRAM: use non-continuous and unreliable data packet connection. SOCK_SEQPACKET: provides continuous and reliable data packet connection. SOCK_RAW: Provides original network protocol access. SOCK_RDM: provides reliable data packet connection. SOCK_PACKET: directly communicates with the network driver.