Reputation: 709
I have been learning how to program sockets, but when I try practice writing codes, I have some problems. The code works for connecting to computers on the same LAN but when I try to connect to two computers on a different network over the internet, I was unable to.
Is this because of the program or is this because of network security?
Where can I find more information on it if I want to make applications communicate over the internet. I was thinking of making a chat program so that I understanding it better but I can't even make the program communicate over the internet!
Edit: Well the port that i am using is 6892. It's just a random port. i'm stil kinda learning these things.
Upvotes: 2
Views: 519
Reputation: 3432
Is one or both or your computers in a local network? If they have IPs starting with 192.168
, they are in a local network.
You can also use http://whatismyipaddress.com/ to check whether the IP displayed is the same with the IP you see on your computers, but remember to remove any proxies.
If the destination computer is in a local network, or the IP displayed in the said website different from what is seen on the computer, you will have a problem. This situation would have nothing to do with your program, but you'll have to configure your networks. You may have to contact your network manager to resolve it.
Upvotes: 0
Reputation: 23770
In some Layer 3 network topologies connections between computers is not bidirectional, and one has to mediate communication via techniques like a federation broker.
A remote station may not address your computer directly, he can only reach up to your gateway, depending on the setup.
Upvotes: 2
Reputation: 606
If you're using native sockets, and you're behind a firewall, this will definitely fail. Your firewall will almost certainly be set to only allow port 80, for http, and port 443 (?) for https.
Upvotes: 3