一个linux典型的select模型更新方法
来源:互联网 发布:js改变css样式 编辑:程序博客网 时间:2024/05/16 11:12
- bool update(int _fd, int _timeout, char *buffer){
- //cout << "update +++++++" << endl;
- fd_set fdClient;
- FD_ZERO( &fdClient );
- FD_SET( _fd, &fdClient );
- struct timeval tv;
- tv.tv_sec = _timeout;
- tv.tv_usec = 0;
- if( select( _fd + 1, &fdClient, NULL, NULL, &tv ) == -1 ) {
- return true;
- }
- if( FD_ISSET( _fd, &fdClient ) ) {
- memset( buffer, 0, sizeof( char ) * GPBUF_SIZE );
- int c = recv( _fd, buffer, GPBUF_SIZE, 0 );
- if( c == -1 && errno != EWOULDBLOCK ) {
- if( errno != ECONNRESET )
- //cout << "peer reset the connection" << endl;
- return true;
- }
- if( c == 0 )
- return true;
- }
- return false;
- }
- 一个linux典型的select模型更新方法
- 一个linux典型的select模型更新方法
- 一个linux典型的select模型更新方法
- 一个linux典型的select模型更新方法
- select模型的一个问题
- 典型的开发模型
- 典型的服务器模型
- 典型的开发模型
- WinSock 下 select() 模型的一个问题
- WinSock 下 select() 模型的一个问题
- golang的select典型用法
- 几种典型的服务器网络编程模型归纳(select poll epoll)
- 几种典型的服务器网络编程模型归纳( select poll epoll)
- linux效率优于select的epoll模型
- Linux网络编程select模型的实现
- linux网络编程之 select()的模型
- linux网络编程之 select()的模型
- Linux网络编程select模型的实现
- 数据结构之排序
- Linux下Socket写http协议下载文件代码以及说明
- c实现一元多项式加乘
- oracle简单对象类型
- asp 导出到excel 方法
- 一个linux典型的select模型更新方法
- 如何成立軟件公司,及其相關的政策
- URL特殊字符的转义
- "非典型性"企业应用:--SaaS正本清源,回归真实
- 常用sql语句
- IT企业管理:拒绝重蹈覆辙
- Eclipse与插件(tomcatPlugin Lomboz easyStruts)安装
- 美国楼市是如何从天堂坠入地狱的
- 微软欲变身敏捷开发典范