当前位置: 技术问答>linux和unix
紧急求救:select轮循,单进程处理多个客户连接问题(TCP/IP),那为大大指教,小弟不胜感激!!代码如下:
来源: 互联网 发布时间:2015-07-07
本文导语: # include # include # include # include # include # include # include # include # include # include # include # include # include # include # define SA struct sockaddr int CheckSockets(int sockfd1); int CliConnection(int sockf...
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# define SA struct sockaddr
int CheckSockets(int sockfd1);
int CliConnection(int sockfd2);
int ReadSocket(int sockfd3);
int CloseConnections();
fd_set rfds, afds;
int maxfd,client[FD_SETSIZE];
int main()
{
int listenfd,sockfd,i,retsec,maxi = -1,n,on = 1;
struct sockaddr_in seraddr;
if ((listenfd = socket(AF_INET, SOCK_STREAM, 0))
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# include
# define SA struct sockaddr
int CheckSockets(int sockfd1);
int CliConnection(int sockfd2);
int ReadSocket(int sockfd3);
int CloseConnections();
fd_set rfds, afds;
int maxfd,client[FD_SETSIZE];
int main()
{
int listenfd,sockfd,i,retsec,maxi = -1,n,on = 1;
struct sockaddr_in seraddr;
if ((listenfd = socket(AF_INET, SOCK_STREAM, 0))