查询到最新的2条

struct sockaddr 和 struct sockaddr_in等价

struct sockaddr  { unsigned short sa_family;     /* address family, AF_xxx */ char sa_data[14];                 /* 14 bytes of protocol address */ }; sa_family是地址家族,一般都是 “AF_xxx”的形式。好像通常大多用的是都是 AF_INET。 sa_data是14字节协议地址。  此数据结构用做 bind、connect 继续阅读

epoll实现并发服务器代码

select/poll/epoll区别? #include "c.h" #define ERR_MSG(msg) do{fprintf(stderr,"line:%d",__LINE__);perror(msg);}while(0) #define IP "192.168.250.100" #define PORT 6666 int deal_cli_msg(int newfd,struct sockaddr_in cin);/ 继续阅读