network programming: how does s.accept() work?
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Mon Feb 25 23:17:26 EST 2008
En Mon, 25 Feb 2008 20:03:02 -0200, 7stud <bbxx789_05ss at yahoo.com>
escribió:
> On Feb 25, 10:56 am, Thomas Bellman <bell... at lysator.liu.se> wrote:
>> 7stud <bbxx789_0... at yahoo.com> wrote:
> In either case, there are still some things about the output that
> don't make sense to me. Why does the server initially report that its
> ip address is 0.0.0.0:
>
> original socket: ('0.0.0.0', 5053)
Because you called "bind" with None (or '' ?) as its first argument; that
means: "listen on any available interface"
> I would expect the reported ip address to be '127.0.0.1'. Also, since
> a socket is uniquely identified by an ip address and port number, then
> the ('0.0.0.0', 5053) socket is not the same as this socket:
>
> new socket, self: ('127.0.0.1', 5053)
You got this *after* a connection was made, coming from your own PC.
127.0.0.1 is your "local" IP; the name "localhost" should resolve to that
number. If you have a LAN, try running the client on another PC. Or
connect to Internet and run the "netstat" command to see the connected
pairs.
--
Gabriel Genellina
More information about the Python-list
mailing list