[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.
See:

    http://catb.org/~esr/faqs/smart-questions.html

and:

    http://www.gweep.ca/~edmonds/usenet/ml-etiquette.html

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

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

    http://mail.python.org/pipermail/catalog-sig/2005-August/0000692.html

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



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,

    82.94.237.218

is an example of an IP address.


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

    python.org



> 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")
6
>>> s.recv(20)
'<!DOCTYPE html PUBLI'
######

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":

    http://www.amk.ca/python/howto/sockets

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

    http://twistedmatrix.com/projects/twisted
    http://twistedmatrix.com/projects/core/documentation/howto/index.html


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