Creating a TCP/IP connection on already-networked computers

Lie Lie.1296 at
Sun Jun 15 16:20:40 CEST 2008

On Jun 15, 8:40 am, John Salerno <johnj... at> wrote:
> Grant Edwards wrote:
> > If the two computers are in no way connected via any type of
> > network, then the two programs won't be able to talk to each
> > other.
> > The programs can't create a network, they can only use one that
> > already exists.
> But isn't that the point of the program, to create a network between the
> two computers? Isn't that what the host and port are used for, to open a
> connection?

No, you don't create a network between the two computers, the OS did,
your program just instruct it to create it and tell the OS to send
some data to it.

I can see that you don't have a clear idea of networking (I'm not a
network expert either, but I know enough). It's basically like this:
networking is arranged in  layers, the lowest layer is the hardware,
the middle-man is the Operating System, and the highest level is your
program. The higher layer works on top of the lower layer, so the
lower layer must first be able to connect before the higher layer can
work. The lowest two layer is the hardware: the cable and the low-
level microcontroller. The cable (or in a wireless network... the
antenna) must be able to reach each other (the cable is connected to
another hardware, the antenna is in range of each other) before the
microcontroller can do anything. The same logic applies, before your
program -- the highest layer -- can do anything, the OS (which handles
layer 3 and 4) must be able to connect to the other computer first.
The easiest (and the most common) way to test whether two computers
can connect to each other is by pinging the other computer, if your
computer can ping the other computer (ping itself lies on the
application layer), any properly written program can connect to the
other computer (unless if there is firewall involved that may gives
some rules on how the two computers may connect).

> (Just to clarify, when I say "in no way connected", I don't mean not
> connected to the internet in general. I know they need access to the
> internet for any kind of networking program to work at all.)

No, they don't need to be connected to the internet for the program to
work at all, they may be in the same local network that isn't
connected to the internet. The basic requirement is, there is a cable
(or for a wireless... well, you get the point) that connects the two
computers, either directly using PC-PC LAN cable, or indirectly
through the same home router, or even more indirectly through the same
"internet" router. Problem is, most home router have firewalls that by
default (and by security requirement) makes connecting two computers
from the internet a little bit harder and different than connecting to
each other from a local network (how and why, has been explained by

More information about the Python-list mailing list