Results 1 to 3 of 3

Thread: Forward Port in Router required for Socket?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    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.

  2. #2
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    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
    Delete it. They just clutter threads anyway.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2008
    Posts
    1,754

    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?

    Code:
    SocketClient sc = new SocketClient("[email protected]",6999);
    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.
    Last edited by noahssite; Aug 19th, 2011 at 02:24 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width