文件名称:IO-(2)
- 所属分类:
- Linux/Unix编程
- 资源属性:
- [Text]
- 上传时间:
- 2013-12-16
- 文件大小:
- 3kb
- 下载次数:
- 0次
- 提 供 者:
- 辰*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
*使用select函数可以以非阻塞的方式和多个socket通信。程序只是演示select函数的使用,即使某个连接关闭以后也不会修改当前连接数,连接数达到最大值后会终止程序。
1. 程序使用了一个数组fd,通信开始后把需要通信的多个socket描述符都放入此数组
2. 首先生成一个叫sock_fd的socket描述符,用于监听端口。
3. 将sock_fd和数组fd中不为0的描述符放入select将检查的集合fdsr。
4. 处理fdsr中可以接收数据的连接。如果是sock_fd,表明有新连接加入,将新加入连接的socket描述符放置到fd。 */
// select_server.c-* use Select function with non blocking mode and multiple socket communication. The program is the use of demonstration of select function, even if a connection is closed will not modify the current number of connections, the number of connections after reaching the maximum value will terminate the program.
1 procedures for the use of an array of FD, communication after the start of the multiple socket descr iptor communication in this array
2 first generate a call sock_fd socket descr iptor, for listening port.
3 the sock_fd and array FD is not 0 descr iptors in select will check the set fdsr.
4 fdsr can be connected to receive data. If sock_fd, indicates that there is a new connection to join, will join the new connection socket descr iptor is placed into the fd.*
//select_server.c
1. 程序使用了一个数组fd,通信开始后把需要通信的多个socket描述符都放入此数组
2. 首先生成一个叫sock_fd的socket描述符,用于监听端口。
3. 将sock_fd和数组fd中不为0的描述符放入select将检查的集合fdsr。
4. 处理fdsr中可以接收数据的连接。如果是sock_fd,表明有新连接加入,将新加入连接的socket描述符放置到fd。 */
// select_server.c-* use Select function with non blocking mode and multiple socket communication. The program is the use of demonstration of select function, even if a connection is closed will not modify the current number of connections, the number of connections after reaching the maximum value will terminate the program.
1 procedures for the use of an array of FD, communication after the start of the multiple socket descr iptor communication in this array
2 first generate a call sock_fd socket descr iptor, for listening port.
3 the sock_fd and array FD is not 0 descr iptors in select will check the set fdsr.
4 fdsr can be connected to receive data. If sock_fd, indicates that there is a new connection to join, will join the new connection socket descr iptor is placed into the fd.*
//select_server.c
(系统自动生成,下载前可以参看下载内容)
下载文件列表
IO (2).txt