Hack Forums
[Python] Question about socket.recv() returning empty - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Question about socket.recv() returning empty (/showthread.php?tid=5400020)



Question about socket.recv() returning empty - datguy.dev - Sep 8, 2016

Greetings,
So I wrote a simple irc bot tho other day. Its working for the most part, besides one thing. Where I have response = socket.recv(1024), it is pulling the correct information from the irc server. Until randomly it starts returning empty or None. This repeats over and over, as it is in a loop, until restarted. It doesn't correct itself after the first error.
I went back and checked the string it should have received. It was just a normal message with no funny business.
This first time this occurred, it lagged my machine down pretty bad despite having a lot of free resources after and no process instances running. Rebooted.
Any ideas?


Figured it out. For those stumbling in, the server requires you to respond to its alive request. I had a formatting error in my send.