开发者

reconnect a disconnected client socket

Is it possible to reconnect an already disconnected socket without having to cre开发者_如何转开发ate a new socket FD?

Example:

int s = socket();
connect(s,...);
....
socket disconnects
....
connect(s,...);   <-------


According to the manpage, "Generally, stream sockets may successfully connect() only once; datagram sockets may use connect() multiple times to change their association." So if your socket is a TCP socket, the answer is "probably not"; if it's a UDP socket, the answer is "probably".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜