ChinaUnix.net
相关文章推荐:

select 返回值

找到原因了

by hdpfh01 - SQL server - 2007-04-11 10:26:16 阅读(2650) 回复(0)

相关讨论

在服务器侧,使用select检查新建的socket是否可读写,超时时间设置为5秒, 但由于采用了多线程,如果在接收线程进入到select后,其他线程中shutdown和close掉这个建立的socket后, select没有立即返回,请问是怎么回事? 谢谢了

by xujian6462 - C/C++ - 2011-08-02 15:27:06 阅读(8994) 回复(4)

如果可以操作了,返回什么?如果在不可以操作的情况下立即返回这时的select返回值是什么?

by john.daker - C/C++ - 2008-11-26 21:59:11 阅读(4884) 回复(4)

看到linux2.4源码里是计算三个集的事件总数返回,我自己写的一个小例子也发现是事件数。 可是,在我一个项目里,当某个套接字同时发生可读和异常时,发现并不计入返回值里。就是我有800多个套接字,分别关注了其读(或写)和异常,某次select发现返回1,但具体FD_ISSET时却只其中一个是可写,其它300多个是可读和异常同时置值。 另外,看lighttpd的源码fdevent_select,也发现它只是认为是发生的句柄数并用它作循环。(当然,它...

by vical - C/C++ - 2009-12-05 15:35:34 阅读(2113) 回复(7)

#include #include #include #include #include #include #include #include #include #include #define PORT 4502 #define BACKLOG 1 #define MAXDATASIZE 4000 #define ONLINE 8000 /*定义一个最大5000人在线的情况*/ #define PTHREAD_THREADS_MAX 50 /*允许一个进程创建这个数量的线程*/ struct ...

by jd808 - C/C++ - 2009-08-06 16:15:54 阅读(4582) 回复(7)

也就是说,如何判断select 语句查询出的结果为0,该如何判断没有找到合适的记录。 不知道我是否说清楚了,请各位大侠帮忙。多谢。

by meteorsnow - PHP - 2006-02-13 20:12:01 阅读(1761) 回复(4)

怎么在mysql里面执行select "象" = "萧,返回值是1 怎么解决? bug? or something else?

by uncooldog - MySQL - 2004-05-28 17:28:33 阅读(1140) 回复(2)
by windsand - MySQL - 2006-05-31 11:31:39 阅读(1404) 回复(3)

比如下面的例子: int sockfd; fd_set fdR; struct timeval timeout = ..; ... for(;;) { FD_ZERO(&fdR); FD_SET(sockfd, &fdR); switch (select(sockfd + 1, &fdR, NULL, &timeout)) { case -1: error handled by u; case 0: timeout hanled by u; default: if (FD_ISSET(sockfd)) { now u read or recv something; /* if sockfd is father and server socket, u can now accept() */ } } } 我根据select返回值大于0,已经得到...

by fdimim - Linux环境编程 - 2008-02-14 09:06:40 阅读(9156) 回复(8)

/*select每次都返回1,sockfd[0]从来没有通过FD_ISSET,而其余4个每次都通过*/ timeout.tv_sec=0; timeout.tv_usec=usec; FD_ZERO(&udpfdset); FD_SET(sockfd[0],&udpfdset); FD_SET(sockfd[1],&udpfdset); FD_SET(sockfd[2],&udpfdset); FD_SET(sockfd[3],&udpfdset); FD_SET(sockfd[4],&udpfdset); selfd=select(Maxfd,&udpfdset,NULL,NULL,&timeout); printf("s%dn",selfd); ...

by cjaizss - C/C++ - 2005-11-08 17:39:43 阅读(5432) 回复(5)

Quite often when you’re writing Linux applications, you may need to examine the state of a number of inputs to determine the next action to take. For example, a communication program such as a terminal emulator needs to read the keyboard and the serial port effectively at the same time. In a single-user system, it might be acceptable to run in a “busy wait” loop, repeatedly scanning the input f...

by xqzhao206 - Linux文档专区 - 2009-11-04 22:19:20 阅读(728) 回复(0)