码迷,mamicode.com
首页 >  
搜索关键字:fd-set    ( 162个结果
select()函数以及FD_ZERO、FD_SET、FD_CLR、FD_ISSET(转)
select函数用于在非阻塞中,当一个套接字或一组套接字有信号时通知你,系统提供select函数来实现多路复用输入/输出模型,原型: int select(int maxfd,fd_set *rdset,fd_set *wrset,fd_set *exset,struct timeval *time...
分类:其他好文   时间:2014-07-28 15:00:53    阅读次数:241
高性能网络编程 - epoll机制
select系统调用不仅对描述符的数量有限制,而且在高并发的情况下,哪怕只有一个活跃的套接字,也要轮询全部的fd set,而epoll采用回调的事件通知机制,只需要处理活跃的套接字。比如Nginx服务器采用的就是epoll,下面这个程序(当接收到大于10B的数据时)展示了epoll在边沿触发和电平触发的不同表现,在edge-trigger模式下,需要我们的程序一次将这次的事情处理完成(比如把数据全...
分类:其他好文   时间:2014-07-12 23:43:37    阅读次数:307
高性能网络编程 - select系统调用
IO复用使得程序能够同时监听多个文件描述符,比如客户端需要同时处理用户输入和网络连接,服务器端需要同时处理监听套接字和连接套接字,select系统调用可以使得我们监听自己感兴趣描述符,可读,可写,异常等事件。select能处理的异常只有带外数据。下面这个程序展示了它的一般用法。 #include #include #include #include #include //bas...
分类:其他好文   时间:2014-07-12 18:53:36    阅读次数:249
【UNIX】select、poll、epoll学习
三者都是UNIX下多路复用的内核接口,select是跨平台的接口,poll是systemV标准,epoll是linux专有的接口,基于poll改造而成。 select 函数原型: intselect(intn, fd_set*readfds, fd_set*writefds, fd_set*exc....
分类:其他好文   时间:2014-07-03 11:44:36    阅读次数:190
Select单进程非阻塞TCP echo服务器
Select单进程非阻塞TCP echo服务器1. select 描述 #include #include int select( int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, const struct...
分类:其他好文   时间:2014-06-28 15:52:47    阅读次数:135
Socket编程之Select模型
echoserver_select.c 1 #include 2 3 #define BACKLOG 10 4 #define PORT 8080 5 #define MAXCLIENT 20 6 #define LEN_BUF 255 7 8 fd_set grset; 9...
分类:其他好文   时间:2014-06-18 16:03:55    阅读次数:325
linux中select的使用方法
fd_set是一组文件描述符(fd,file descriptor)的集合,它用一位来表示一个fd。系统提供了4个宏对描述符集进行操作: #include #include //设置文件描述符集fdset中对应于文件描述符fd的位(设置为1)void FD_SET(int fd, fd_set *f...
分类:系统相关   时间:2014-06-04 20:48:17    阅读次数:343
Linux下I/O复用 Select与Poll
Select#include #include #include int select (int n, fd_setreadfds, fd_setwritefds, fd_setexceptfds, struct timevaltimeout);FD_CLR(int fd, fd_set *set)...
分类:系统相关   时间:2014-05-31 02:32:17    阅读次数:508
select在并发中的两点限制与poll函数的使用
用select实现的并发服务器,能达到的并发数,受两方面限制 一个进程能打开的最大文件描述符限制。这可以通过调整内核参数。 select中的fd_set集合容量的限制(FD_SETSIZE) ,这需要重新编译内核。...
分类:其他好文   时间:2014-05-15 05:19:35    阅读次数:390
用select单个进程处理并发服务器
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); void FD_CLR(int fd, fd_set *set); int  FD_ISSET(int fd, fd_set *set); void FD_SET(int fd, fd...
分类:其他好文   时间:2014-05-14 00:03:02    阅读次数:440
162条   上一页 1 ... 14 15 16 17 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!