1 sockaddr_in, sockaddr_in6, and Sockadd_un can be cast to sockaddr.
The 2 IP address is a string in the form of a decimal, but is used in the network using a number of type unsigned int.
- in_addr_t inet_addr (const char* strptr); Returns the address of the IPv4 usigned int type.
- int Inet_aton (const char* CP , struct in_addr* INP); If nonzero is returned successfully, the 0
- char * INET_NTOA () If the failure returns null if the correct dotted decimal address is returned successfully.
- int net_pton (int af, const char* src, void* DST); Dot decimal is converted to a network address. Applies to IPv4 and IPv6
- const char* inet_ntop (int af, const void* SRC, char* DST, socklen_t CNT); The network address is converted into a dotted decimal address. Applies to IPv4 and IPv6
3 function Listen, the second parameter backlog, indicates the maximum length of the kernel listener queue, if the number of the set value of +1 is exceeded (if the test is more than the set value in Windows connection, will not be connected), the server will not accept new customer connections. As long as you do not accept, the number of sockets in the kernel queue will not be reduced.
4 Close: When we close the connection, we use close to actually just subtract the reference count of the file descriptor by 1, and one fork causes the open see Descriptor reference count in the parent process to be added by 1. So in this case we should do a close to the file descriptor in the parent-child process. If you want to terminate the connection directly, you can use the shutdown function, with the values of the parameter howto shut_rd, SHUT_WR, and Shut_rdwr respectively.
5 Msg_oob data. The send and RECV functions can set the message options, when set to emergency data (MSG_OOB), only one byte of emergency data, if the message sent is a multibyte message, only the most one byte is the emergency data.
6 UDP sends data using SENDMSG, receiving data using RECVMSG, similar to send and recv, is just the parameters of the socket address structure. These two functions can also be used with TCP, when used for TCP, with the following two parameters set to null.
TCP/IP Learning---4 (Linux network base API)