Forward Port in Router required for Socket?
Hello, I was just thinking about the way Sockets and Ports work. For a client to connect to a server the correct ports on that server have to be open for data to be sent from the client and received on the server. If I were to write a chat application then on each computer that has my chat appliation installed they would have both a server and a client. Or they could have a client each and then on one of my computers I would have the central server. So my question is, how are applications like MSN, Skype and AIM able to communicate with other MSN, Skype and AIM accounts (send/receive) without opening a port in the user's home router. When I installed Skype I did not have to open any specific ports, it just started working automatically.
Re: Forward Port in Router required for Socket?
It uses NAT (network address translation), which basically is a technique that allows you to map an external port to an internal port on a specific IP address.
Since you posted this in the Java section I looked around for a library that might help you: JSTUN
Re: Forward Port in Router required for Socket?
Thanks for the link. I understand that an external port would be mapped to an internal address behind a firewall which is why at the moment my chat application which listens on port 6999 requires 6999 to be forwarded to the computer that it is loaded on via the NAT section of the router. However Skype doesn't do this - it doesn't require the user to manually forward a port.
How does my friend's Skype connect to my Skype? How does it bypass the router and go straight to the computer?
EDIT: Using Sockets in Java is there a way to reference a specific computer behind an IP Address when connecting via the SocketClient?
192.168.0.87 being the IP Address of the computer behind the router.
73.21.523.23 being the IP Address that could be gained for example from a website like whatismyip.com.