Cross Network communication using Winsock2?

This is a discussion on Cross Network communication using Winsock2? within the Networking/Device Communication forums, part of the General Programming Boards category; Hi
Is it possible for 2 machines on comletely different networks communicate with each other using Winsock2?
Regards
dp_76...

Yes it is possible however at least one machine (the server) needs to be able to accept incoming connection from the internet. Either the server machine has been assigned an internet IP address as well as it's local network IP address or the network router needs to be configured to foreward a specific internet port to a port on the local network machine, then the connecting machine connects to the externally known IP and the router forewards the connection to the local IP of the machine.

The client is on a machine in my local network.
The server application is on a different machine in some other network.
The server application machine has an ip address & the client is aware of server's ip.
Both client & server r connected to internet.
Can they communicate using winsock2.

Y i ask this is because i have developed a client server application using mfc & winsock2.

When client & server run on different mchines within the same network, the communicate & do the needfull.
But when in different networks, they fail to connect.

Hi
The server application is on a different machine in some other network.
The server application machine has an ip address & the client is aware of server's ip.

If the server's IP that the client is aware of is in one of these ranges
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
Then that is it's local network IP address which is only valid on the same network.
YOu need it's externally known IP address and to make sure the networks's router is forewarding connections as mentioned above.
This is because there can be many hosts on a network and only one external IP address so the router needs to be explicity configured to foreward connection to a certain IP address. If you're not the administrator of either router then you won't be able to get them to communicate directly, however both client and server could connect to a server on the internet which they can both access to communicate.