Question pc to pc communication with Server/Client

kzdev

Member
Joined
Jan 3, 2010
Messages
6
Programming Experience
3-5
I use Microsoft Visual Basic 2008 Express Edition and I am begginer in computer networks.

I want to make two PCs communicate via network using server/client

I followed the example from this site: VB.NET TCP Client/Server Socket Commmunications

When I run the applications server and client in one computer then is possible the client to connect with server.

When I use two computers via network, in the first computer I run the server application and in the second computer the client application then the client it gives me error message like:

No connection could be made because the target machine actively refused it 127.0.0.1:8000

How can I solve this issue?
 

anthony.selby

Well-known member
Joined
Sep 3, 2009
Messages
65
Programming Experience
5-10
that is connecting to itself ... . are you running the client and the server on the same machine ?
 

anthony.selby

Well-known member
Joined
Sep 3, 2009
Messages
65
Programming Experience
5-10
the address 127.0.0.1 point back to itself ... somewhere in your program you need to give it the address of the other computer ...
 

kzdev

Member
Joined
Jan 3, 2010
Messages
6
Programming Experience
3-5
Some months ago the problem of communication in Client/Server solved using the IP address of my PC and the IP address of the other PC in the local network.

Now I want to commucinte between two computers but not in the local network, but between remote network.

I used the following IP Tracer, IP Tracker, IP Locator and other DNS tools
to locate the IP address for each remote computer. Giving those IP address in each client/server application in remote computers, they can't communicate between them.

Where I mistake? Any suggestion?
 

anthony.selby

Well-known member
Joined
Sep 3, 2009
Messages
65
Programming Experience
5-10
you probably aren't screwing up ... you are probably being blocked are there any personal routers in the way ?
 

kzdev

Member
Joined
Jan 3, 2010
Messages
6
Programming Experience
3-5
Actually my DSL modem follows a router that interconnect two pcs.

(I check in both pc's using the IP adress locator but both of them have the same IP address is that normal?)
 

anthony.selby

Well-known member
Joined
Sep 3, 2009
Messages
65
Programming Experience
5-10
Its kinda normal ...

{Internet} ---- {Modem} --- {Router} --< {Both PCs}

if it looks like that ... you need to use the internal address

{PC1} --- {Router} ---{Modem} --- {Internet} --- {Modem} --- {Router} --- {pc2}

if it looks like this ... you need to setup the routers
 

kzdev

Member
Joined
Jan 3, 2010
Messages
6
Programming Experience
3-5
Yes, two pcs must communicate like this.

{PC1} --- {Router} ---{Modem} --- {Internet} --- {Modem} --- {Router} --- {PC2}

But what do I have to configure in router?

I guess both PC1 and PC2 to communicate between them, must be known them IP address, that is different from the address that the IP locator gives to me. Is my thinking is right?

So, how can find PC1 and PC2 IP address to make them communicate?
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,412
Location
Norway
Programming Experience
10+
You must connect using the public ip. In router you need to set up port-forwarding so that the incoming connection that arrives the router is forwarded to the correct computer in your local network. You can find many resources on the web about port-forwarding, just about any kid that does P2P knows how to do this ;) Also, any firewall must allow the traffic through that port.
 
Top Bottom