![]() |
How do I reconnect a disconnected socket?
I'm trying to make something that once it is disconnected will automatically try to reconnect. I'll add some more features in later so it doesn't hammer the server but right now I just want to keep it simple and get that part working. The problem is that when I use sock.close I get an error message of
:
Bad File Descriptor:
Transport endpoint is already connectedThis is what I've got right now: :
What am I doing wrong? |
Re: How do I reconnect a disconnected socket?
Hmm well i think you may find it is because when you call socket.close()
your socket becomes blank so to speak. :
and so by moving the declaration of your socket into your doconn() function everytime you try to connect it re-defines the socket. I thinks this works anyway plus i've no doubt been talking aload of rubbish but there we go Chris |
Re: How do I reconnect a disconnected socket?
When you close the socket, it'll be closed. You can reconnect with a new socket, but you can't use the same one. When it's closed, both OSs will terminate the connection.
|
Re: How do I reconnect a disconnected socket?
Quote:
|
| All times are GMT -5. The time now is 9:12 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC