为tcp的connect设置超时时间
2014-03-16 17:47
429 查看
struct timeval tv = {timeout, 0};
27 setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(struct timeval));
28 //setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(struct timeval));//设置接收超时,不能对connect起作用。
27 setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(struct timeval));
28 //setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(struct timeval));//设置接收超时,不能对connect起作用。
相关文章推荐
- 设置linux中tcp默认的20秒connect超时时间(转)
- 设置linux中tcp默认的20秒connect超时时间
- 设置TCP connect超时时间的2种方法
- 设置socket connect 超时时间
- TCP服务端要设置超时时间
- 六、TCP C/S:Linux connect 超时设置
- 如何设置connect超时时间
- VC socket Connect 超时时间设置
- 设置connect超时时间
- VC socket Connect 超时时间设置
- C# 的tcp Socket设置自定义超时时间
- TCP编程:client设置超时收包时间,收包失败,关闭连接。
- python TCPServer, StreamRequestHandler设置超时时间timeout
- 设置connect超时时间
- Modbus Poll 设置Modbus TCP通信超时时间
- 设置TCP阻塞模式下的发送和接收函数超时时间
- VC socket Connect 超时时间设置
- 如何设置connect超时时间
- WebLogic如何设置session超时时间
- 为jQuery的$.ajax设置超时时间