![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Mar 2008
Posts: 1
Rep Power: 0
![]() |
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 connected This is what I've got right now: python Syntax (Toggle Plain Text)
What am I doing wrong? |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
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. Python Syntax (Toggle Plain Text)
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
__________________
Who said i couldn't program sarcasm = raw_input('Type in a sarcastic remark: ')
|
|
|
|
|
|
#3 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 754
Rep Power: 3
![]() |
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.
__________________
<insert disclaimer here> <insert shameless plug for Visual Studio here> |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
|
Re: How do I reconnect a disconnected socket?
thats what i was trying to say but just couldn't lol thanks Jimbo
__________________
Who said i couldn't program sarcasm = raw_input('Type in a sarcastic remark: ')
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java socket Server compile errors.. | n3o_X | Java | 3 | Nov 18th, 2007 12:39 AM |
| Streaming Sound Over a Socket | King | C++ | 3 | Apr 7th, 2007 5:29 PM |
| how to check if the socket is still connected? | myName | C++ | 1 | Jun 14th, 2006 6:27 AM |
| Socket Server | hbe02 | C++ | 19 | May 23rd, 2006 10:14 PM |
| Socket problem | Polyphemus_ | C++ | 3 | Feb 28th, 2006 2:01 PM |