[Tutor] information needed to make a connection between computers

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Mon Dec 12 01:01:19 CET 2005

[Taking catalog-sig and python-list out of CC.]

John, please don't crosspost.  catalog-sig in particular is off-topic of
your question.  When we crosspost, we add noise to those lists and
frustrate members of the community.  It's generally a bad thing to do.




for more details about this.  Please make sure your replies are only going
to a single mailing list unless you really have overriding reasons for

In fact, you've been called on this behavior back in August:


Ian Bicking there was fairly civil, but you need to pick up on the clue:
he didn't give you much help besides saying, in effect: you're posting on
the wrong mailing list, and he and others on catalog-sig won't even bother
responding to you if you ignore his request for topicality.

It look like you didn't really hear what he said, so let me say it
explicitely: crossposting is considered inconsiderate behavior.  If you
continue to do so, people will respond in kind by ignoring your questions,
and that will be bad.  So avoid getting people annoyed: don't crosspost.

Anyway, to your question.

> I don't know whether or not this is the same for Python, but could
> someone please tell me what information of the computer you want to
> connect with the you actually need for a connection?

Computers on the internet all have an IP address in the form of dotted
numbers.  For example,

is an example of an IP address.

Many computers on the Internet can register to get a nice, mnemonic name,


> In other words (or plain english), what information do I need to get a
> connection with another computer (IP address, name, IP name)? Also,
> could you tell me how to find it on a computer?

Either IP address or name should be sufficient.  For example, here's a
little snippet of code that shows how we might contact the web server on
Python.org.  (Note that in real life, we'd probably use the 'urllib'
library instead.):

>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> s.connect(("python.org", 80))
>>> s.send("GET /\n")
>>> s.recv(20)

Here, we're able to pass 'python.org', which the network will use to find
the Python.org webserver.  We also tell the system to talk to port 80; a
single computer has a bunch of numeric ports, each which is dedicated to a
job.  Port 80 is reserved for web serving.

Let me see if I can pull some resources for you... Ok, there's a tutorial
on low-level networking from Gordon McMillan's "Socket Programming HOWTO":


You may also want to look at high-level modules like Twisted, which
provide some extra support for network programming:


If you are looking for more introductory information on network
programming, please feel free to ask, and I'm sure on of us can find
something useful for you.

Good luck.

More information about the Tutor mailing list