via:http://stackoverflow.com/questions/8145624/getpeername-can-not-recognize-connection-established
To determine if the socket is connected, it is more usual to use getsockopt() rather than getpeername():
int so_error;
socklen_t len = sizeof(so_error);
getsockopt(sock, SOL_SOCKET, SO_ERROR, &so_error, &len);
if (so_error == 0) {
/* socket is connected */
}
最后
以上就是包容西装最近收集整理的关于非阻塞connect errno为EINPROGRESS,如何判断已经连接上了?的全部内容,更多相关非阻塞connect内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复