   Avoiding Port Forwarding
  I've built an ultra simple utility that compresses, encrypts and hashes a file and sends it over to a destination IP:Port pair, but either the Server or the Client can't be behind a router, and if that is true, at least one will need port forwarding.So, how exactly am I able to talk to another person on MSN which is behind an unforwarded router, while I'm in the same situation?Or, like I think it is done, am I and that person both connected to MSN's central Server which detects we can't directly connect to each other, and so handles itself the packet load, as a bridge of sorts?Thanks for any tips on this...   
Quote:Original post by ProzakSo, how exactly am I able to talk to another person on MSN which is behind an unforwarded router, while I'm in the same situation?Or, like I think it is done, am I and that person both connected to MSN's central Server which detects we can't directly connect to each other, and so handles itself the packet load, as a bridge of sorts?Pretty much. Both you and the other user make an outgoing connection to the MSN server, which allows you each to communicate with the server in both directions. The server then acts as a relay.MSN does a bit of trickery from what I can tell, and if it can manage to open a port on either computer via UPnP, it'll let you connect directly, which is faster and won't require as much bandwidth for the server. Quite how that works though, I have no idea...   ;  Either relay everything through a third party server, or use some kind of NAT punch-through.In brief, it works something like this.Let's say you use UDP for your application. Now, the two users get each other's IP and port somehow (maybe through a server you set up to perform this handshake, or maybe they just tell each other over MSN or whatever).Now, A sends a few packets to B, on the agreed IP/port, then A's firewall/router will usually expect B to reply, so it opens up for packets originating from B with A as destination. Of course, A's packets will be dropped once they reach B's firewall router, but that doesn't matter. At least A's firewal has been configured now.Now B does exactly the same thing. Then his firewall will usually open up for packets originating from A as well. And voila. Suddenly A and B can send packets to each others without a problem.Of course, it relies on the routers/firewalls behaving in this way (which isn't always the case, but it's common).Other than that, you might want to look into UPnP, but I'm not too sure how that works.   