Skip to content Skip to sidebar Skip to footer

Python Tcp Socket.recv() Returns With Nothing As Soon As Connection Is Made

I'm trying to implement the most basic python TCP server. Windows 8, Python 2.7, firewall is turned off. Code is from here: https://wiki.python.org/moin/TcpCommunication If I do

Solution 1:

Yes, this is expected behavior.

The client does not send anything. And it exit as soon as it connect to the server; cause disconnection.

socket.recv returns an empty string if the peer performed shutdown (disconnect).

While, in the REPL, the socket is not closed until you issue sys.exit() or you quit the interactive shell.


Post a Comment for "Python Tcp Socket.recv() Returns With Nothing As Soon As Connection Is Made"