سؤال

i've done an IRC-Bot in Python. I wanted to create a shutdown command. It look like this:

self.SendMessage("Bye!", self.connectedchannel) # Send bye to the connected channel
self.connection.shutdown(socket.SHUT_RDWR) # Shutdown the socket
self.connection.close() # Close the socket
sys.exit() # Exit the program

But in IRC the bot disconnects with "EOF from client", it doesnt disconnect properly. How to change my code it does?

هل كانت مفيدة؟

المحلول

Before you close the socket, send an QUIT message:

QUIT :Bye!

This should fix it.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top