Using TCP/IP

Peter Hansen peter at engcorp.com
Thu Oct 2 13:56:59 EDT 2003


jblazi wrote:
> 
> First I wanted to write my own course but the official
> tutorial is virtually perfect. The first program we shall write is a
> mastermind program and it would be nice if my pupils could play that over
> the internet too. The first point is that they have not permanent ip
> numbers so the ip number has to be found out first.

Most programs don't try to figure out the IP address of the machine on which
they are running.  Instead, they require the IP address of the *other* machine
to which they will talk.  For that, you could just have the students type
"ipconfig" at a command line and save yourself the trouble.  As others have
pointed out, in many situations, probably such as would always exist at a 
school, machines on the network are not given "routable" (public) IP addresses
and you couldn't connect to them from the Internet anyway.

Another approach is to have a central server which handles the match-making
process.  Then the only thing needed is the address of that server.

My suggestion is you cut scope and skip this whole aspect, and just 
assume the address information is available externally to the program.
That's how 99.9% of similar software works.

-Peter




More information about the Python-list mailing list