我是靠谱客的博主 包容西装,这篇文章主要介绍非阻塞connect errno为EINPROGRESS,如何判断已经连接上了?,现在分享给大家,希望可以做个参考。

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内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(139)

评论列表共有 0 条评论

立即
投稿
返回
顶部