I'm writing a IRC bot in Python.
Source: http://pastebin.com/gBrzMFmA ( sorry for pastebin, i don't know how to efficently/correctly use the code tagthing on here )
When the "irc" socket dies, is there anyway I could go about detecting if its dead and then automatically reconnecting?
I was googling for awhile now and found that I would have to create a new socket. I was trying and added stuff like catching socket.error in the while True: but it seems to just hang and not reconnect correctly..
Thanks for help in advance
Answered here: Python : Check if IRC connection is lost (PING PONG?)
While the question owner's accepted answer works, I prefer John Ledbetter's answer here, soley for its simplicity: https://stackoverflow.com/a/6853352/625919
So, for me, I have something along the lines of
This is the code for Re-Connect socket