Click to See Complete Forum and Search --> : Two computers behind a router


MoHammaD_93
August 21st, 2009, 05:46 PM
Hello,,

How can MSN Messenger transfer a file between two computers while each one is behind a router,, How can it make one of them a server,,

Doesn't it need to forward a port or make a public IP??

I really do need to do the same,, I need to make my computer client wheras the another (which is behind a router) is server? (Does MSN Messenger forward a port or make a public IP program?)

I really do need it,, AND THANX IN ADVANCE!
My respects
BYe..

MoHammaD_93
August 23rd, 2009, 08:51 AM
Any idea?

hoxsiew
August 23rd, 2009, 10:40 AM
I don't know anything about MSN Messenger, but I assume that there is a server to which both clients connect. If so, then it doesn't matter how many firewalls are between the two clients as they will be communicating with a server that IS open to the rest of the internet. As far as I know, there's no way for two peers behind restricted routers to do this without either some sort of NAT route, or a central server both can reach. That's the whole point of a firewall.

dglienna
August 23rd, 2009, 02:58 PM
Nope. MSN takes a look at your system. If it see's a router is blocking common ports, then it will tell the host to use a different port. The host tries, and reports back.

All these requests are going thru the host. If you make a DIRECT CONNECTION, then the host is out of it.

hoxsiew
August 24th, 2009, 08:43 AM
That makes sense if both computers are behind the SAME firewall, but what about the case of the OP of two different networks with one or both behind their own firewall? We use skype internally for our company IM needs and it will do direct machine to machine transfers within our network, but if we have an affiliate working off-site, and do a file transfer, skype routes it through a third-party transfer server.

MoHammaD_93
August 24th, 2009, 09:55 AM
Thank you,

So MSN transfers the files between the computers directly,, what I need is how to write my own code that does what MSN Messenger does to accomplish this point..

Thank you again.

MikeAThon
September 10th, 2009, 12:02 PM
Nope. MSN takes a look at your system. If it see's a router is blocking common ports, then it will tell the host to use a different port. The host tries, and reports back.

All these requests are going thru the host. If you make a DIRECT CONNECTION, then the host is out of it.
I don't think that this is completely correct. It's actually very hard for an application to "take a look at the system's router", and it probably can't be done unless there are some supporting mechanisms in place.

The main mechanism is probably UPnP (universal plug-n-play).

IF UPnP is in place in the computer, and IF UPnP is in place in the router, then MSN will be able to map a port on the router. Port mappings (at at least one end of the conversation) will allow two computers behind routers to communicate (see the concepts of port fowarding and NAT, etc).

MS provides the IUPnPNAT interface for NAT and port mappings using UPnP. See "IUPnPNAT Interface (Windows)" at http://msdn.microsoft.com/en-us/library/aa366182(VS.85).aspx

If port mappings cannot be made, then MSN has no other option, and the two ends of the conversation must communicate through a 3rd party server. Direct communication is not possible.

There are some "tricks" out there which sometimes work for some brands of routers (depending on their internal programming), and which allow direct communication without a port mapping. The main trick is called "hole punching". However, even "hole punching" requires a 3rd party server in order to initiate the trick.

Firewalls are another matter. The MSN application must be registered with the correct firewalls at both ends of the conversation, in order to communicate. In other words, unless both firewalls and routers can be traversed, then the communication cannot happen.

the OP needs to do the same in his application.

Mike