Reconnect a disconnected client socket

Is it possible to reconnect an already disconnected socket without creating a new FD socket?

Example:

int s = socket();
connect(s,...);
....
socket disconnects
....
connect(s,...);   <-------
+3
source share
1 answer

According to the manpage : "Typically, stream sockets can only successfully connect () once, datagram sockets can use connect () several times to change their connection." Therefore, if your socket is a TCP socket, the answer is "probably not"; if it is a UDP socket, the answer is "possible."

0
source

All Articles