socket question

Philippe C. Martin philippecmartin at sbcglobal.net
Mon Feb 7 12:11:43 EST 2005


Hi,

I am following a few tutorial and this howto:


*************************************************************
...........
What happens in the web server is a bit more complex. First, the web
server creates a "server socket".

    #create an INET, STREAMing socket
    serversocket = socket.socket(
        socket.AF_INET, socket.SOCK_STREAM)
    #bind the socket to a public host, 
    # and a well-known port
    serversocket.bind((socket.gethostname(), 80))
    #become a server socket
    serversocket.listen(5)

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.
...........
*************************************************************

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 ?

Regards,

Philippe
















-- 
***************************
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
***************************




More information about the Python-list mailing list