#include<sys/socket.h>
int socket(int family, int type, int protocol);
//return 0 when success ,otherwise -1
listenFd = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
socket函数创建一个未绑定ip和端口的套接字。
3.bind函数
#include<sys/socket.h>
int bind(int sockfd, const struct sockaddr* myaddr, socklen_t *addrlen);
//return 0 when success ,otherwise -1
bind函数将套接字绑定到指定的地址myaddr上
4.listen函数
#include<sys/socket.h>
int listen(int sockfd, int backlog);
//return 0 when success ,otherwise -1