Creating a TCP/IP connection on already-networked computers

Grant Edwards grante at visi.com
Sat Jun 14 15:26:24 EDT 2008


On 2008-06-14, John Salerno <johnjsal at gmailNOSPAM.com> wrote:
> John Salerno wrote:
>
>> -----
>> #!/usr/bin/env python
>> 
>> from socket import *
>> from time import ctime
>> 
>> HOST = '192.168.1.100'
>
>
>> -----
>> #!/usr/bin/env python
>> 
>> from socket import *
>> 
>> HOST = '192.168.1.100'
>
> A question about this. Is the "HOST" referring to the IP
> address of the server computer in both of these cases?

Yes.

> Because when I ran the program and got to the part where it
> says "connected from:" on the server side, it shows this same
> IP address.

Then you must have been either running the client program on
the same machine as the server program or you've got some sort
of NAT/port-forwarding going on.

> Shouldn't it be something different, since the requests are
> coming from a different computer than the server computer?

Works fine for me.  When I run the client program on a machine
different than the server program, the server program prints
out "connected from:" and then the client machine's IP address.

-- 
Grant Edwards                   grante             Yow! Maybe I should have
                                  at               asked for my Neutron Bomb
                               visi.com            in PAISLEY --



More information about the Python-list mailing list