select模型的应用
来源:互联网 发布:java snmp4j jar 编辑:程序博客网 时间:2024/05/16 11:05
for ( ;; )
{
fd_set readfds;
fd_set writefds;
FD_ZERO( &readfds );
FD_ZERO( &writefds );
FD_SET( sock, &readfds );
int maxfd = sock;
timeval to;
to.tv_sec = 2;
to.tv_usec = 0;
int n = select( maxfd + 1, &readfds, &writefds, NULL, &to );
if ( n > 0 )
{
if ( FD_ISSET( sock, &readfds ) )
{
int iread = recvfrom(sock, (char *)&usercount, sizeof(int), 0, (sockaddr *)&remote, &fromlen);
if(iread<=0)
{
throw Exception("Login error/n");
}
break;
}
}
else if ( n < 0 )
{
throw Exception("Login error/n");
}
sendto(sock, (const char*)&sendbuf, sizeof(sendbuf), 0, (const sockaddr*)&remote,sizeof(remote));
}
- select模型的应用
- select模型应用
- Select模型的学习
- winsock的select模型
- select模型的使用
- select模型的实现
- winsock的select模型
- winsock的select模型
- ACE的Select模型
- select模型的使用
- Select模型的简单实现
- 服务器Select模型的实现
- select模型的服务器源码
- Select模型---很经典的
- Select模型---很经典的
- Select模型的使用常识
- select模型的示例代码
- socket编程的select模型
- 项目风险管理之风险识别
- 推荐《游戏之旅--我的游戏编程感悟》
- SOA新手入门
- Linux下find命令详解
- 一个有趣的免费资源:snap shots
- select模型的应用
- tcl/tk参考——tcl内建命令
- IRP结构
- c/c++中得main函数
- smallbusiness源碼
- Hello CSDN
- 深入JVM(二):java里的堆(heap)栈(stack)
- Linux系统下安装ISO文件
- MS SQL存储过程分页