Overview
Features
Download
Documentation
Community
Add-Ons & Services

Reconnecting a client socket

Please post support and help requests here.

Reconnecting a client socket

Postby gandriotakis » 17 Apr 2013, 16:25

I have a TCP client application that needs to be able to reconnect after a connection to a server is lost. I am connecting a StreamSocket using connectNB and using a SocketReactor to handle socket events. Everything works fine up to this point. I then detect the lost connection (onReadable with 0 bytes), delete the StreamSocket, create a new one and try connectNB again. When the server comes back online the connection is never made. I deleted the socket so there should be no state left but it is almost as if the new socket is not attempting to connect the second time. The ::connect call returns -1 and the last error is POCO_EWOULDBLOCK (the same as the initial successful attempt to connect). Any suggestions?
gandriotakis
 
Posts: 29
Joined: 02 Dec 2011, 20:45

Re: Reconnecting a client socket

Postby gandriotakis » 17 Apr 2013, 20:46

FYI, before I close the socket I remove the handlers from the SocketReactor and then after I recreate the socket I add them back with the new socket.
gandriotakis
 
Posts: 29
Joined: 02 Dec 2011, 20:45


Return to Support

Who is online

Users browsing this forum: No registered users and 4 guests