socket object, connection refused ...

Diez B. Roggisch deets_noospaam at web.de
Mon Nov 17 15:52:23 EST 2003


Hi,

> using 'localhost' or '127.0.0.1' always works, using my actual machine's
> ip or its hostname does not!!

I had the exact problem last week - I think there should be an update to the
docs, as these say:

<quote from socket example>
# Echo server program
import socket

HOST = ''                 # Symbolic name meaning the local host

</quote from socket example>

Unfortunately, this is not right - what happens wheny you bind localhost or
127.0.0.1, the socket _only_ listens on your local loop back device. When
binging to '', this means "bind to all IPs of this machine" - and thats
exactly what you are looking for.

So try to either explictely bind to your IP, or '' - that will help.

Regards,

Diez




More information about the Python-list mailing list