Socket recv(1) seems to block instead of returning end of file.

Bryan Olson fakeaddress at nowhere.org
Fri Aug 24 00:23:20 EDT 2007


Grant Edwards wrote:
[...]
> import socket,random
> 
> HOST = ''                 # Symbolic name meaning the local host
> PORT = 8765               # Arbitrary non-privileged port
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s.connect((HOST, PORT))

Actually the empty string passed for the host means INADDR_ANY,
which does not really make sense for the client. On my Win-XP
system, the client fails with

   socket.error: (10049, "Can't assign requested address")

For the loop-back adapter, 'localhost' or '127.0.0.1' should
work.


-- 
--Bryan



More information about the Python-list mailing list