socket question
Philippe C. Martin
philippe at philippecmartin.com
Mon Feb 7 12:48:10 EST 2005
Thanks you! that did it.
PS: the 'wrong' info I got seems to be in the official howtos
http://www.amk.ca/python/howto/sockets/
Regards,
Philippe
On Mon, 07 Feb 2005 18:23:28 +0100, Diez B. Roggisch wrote:
>> A couple things to notice: we used socket.gethostname() so that the
>> socket would be visible to the outside world. If we had used s.bind(('',
>> 80)) or s.bind(('localhost', 80)) or s.bind(('127.0.0.1', 80)) we would
>> still have a "server" socket, but one that was only visible within the
>> same machine.
>
> This is wrong. There is a difference between passing '' and 'localhost'. The
> latter binds the socket only to the ip 127.0.0.1, where '' binds it to all
> available ips.
>
>> My problem is that I cannot connect to my server if the client is not on
>> the same PC (although I'm doing the above).
>> Also:
>> 1) my server has more than one IP addresses
>> 2) my server does not have any DNS name
>> ... so I want to connect to an IP address that I can ping but has no
>> name.
>> How can I do that ?
>
> Pass the ip as hostname (as string like "192.168.1.10")
More information about the Python-list
mailing list