1. 使用bzero而不是memset
  2. 使用inet_pton而不是inet_addr
  3. struct sockaddr, that is, a generic socket address structure. Everytime one of the socket functions requires a pointer to a socket address structure, that pointer must be cast to a pointer to a generic socket address structure. (因为socket函数出现的时候还没有void*)struct sockaddr太长了,一般会缩写成SA
  4. tcp编程里关于读数据 when reading from a TCP socket, we always need to code the read in a loop and terminate the loop when either read returns 0 (i.e., the other end closed the connection) or a value less than 0 (an error).
  5. 协议无关性 getaddrinfo:这个函数可以写出和协议( IPv4 or IPv6) 无关的代码