socket : a form of file.For example, you can use the syscalls used on file descriptors, read() and write(), on socket descriptors.
inet all nets using Inernet protocol : intranet + extranet + internet
AF address family
PF protocol family
sa socket address
sockfd file descriptor
backlog the maxsize number of connection
inaddr_any listen to all interfaces
// create a socket, return the sockfd (file decriptor)intsocket(int family,int type,int protocal);// assign a local address to a socketintbind(int sockfd,conststructsockaddr*myaddr,socklen_t addrlen);// change the state of created socket from CLOSED to LISTEN, and define backloglisten(int sockfd,int backlog);// accept a connection on a socket, addrlen should be initialized, or return null// return value error:-1 or a file decriptor for the accepted socket (from client)intaccept(int sockfd,conststructsockaddr* cliaddr,socklen_t*addrlen);// 1.complete the binding necessary, 2.attempt to make a connection to another socketintconnect(int sockfd,conststructsockaddr*servaddr,socklen_t addrlen);// read from or write to a file descriptor ssize_tread(int sockfd,constvoid*buf,size_t count);ssize_twrite(int sockfd,constvoid*buf,size_t count);// host to network long/shorthtonl(uint32_t hostlong);htons(uint16_t hostshort);// network to host long/shortntohl(uint32_t netlong);ntohs(uint16_t netshort);// concert binary text to addrchar*inet_addr(int af,);// convert IP addr from bi to string, from src, copied to buffer dst, char*inet_ntop(int af,constvoid*restrict src,char*restrict dst,socklen_t size);