KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
From test, I concluded that in following three cases the socket.recv(recv_size) will return. After the connection was closed. For example, the client side called socket.close() or any socket error occurred, it would return empty string. Some data come, the size of data is more than recv_size . Some data come, the size of data is less than recv_size and no more data come after a short time (I found 0.1s would work). More details about #3: #server.py while True: data = sock.recv(10) print data, 'EOF' #client1.py sock.sendall("12345") sock.sendall("a" * 50) #client2.py sock.sendall("12345") time.sleep(0.1) sock.sendall("a" * 50) When I run client1.py , the server.py echos: 12345aaaaa EOF aaaaaaaaaa EOF aaaaaaaaaa EOF aaaaaaaaaa EOF aaaaaaaaaa EOF aaaaa EOF When I run client2.py , the server.py echos: 12345 EOF aaaaaaaaaa EOF aaaaaaaaaa EOF aaaaaaaaaa EOF aaaaaaaaaa EOF aaaaaaaaaa EOF Are my conclusions correct? Where can I see the official description about #3?
Tags (comma-separated)
Save Edits
Cancel