一个linux典型的select模型更新方法
来源:互联网 发布:惠州网络推广方案 编辑:程序博客网 时间:2024/05/21 22:53
- 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模型的实现
- IP数据包分类经典算法总结
- WPF显示常用的几个显示文字控件TextBox, TextBlock, Lable
- 第七章 函数
- Linux下ping命令实现详解
- ECshop目录结构
- 一个linux典型的select模型更新方法
- 深入 理解 Statement 和 PreparedStatement
- strtok语法
- 观史评Tegra、谁是智能机芯中强者?
- ecshop改动60
- 数据是怎么被压缩的
- kmalloc文章
- 个税思考
- Linux下Socket写http协议下载文件代码以及说明