Programming a connection to a user on a private network

Started by
14 comments, last by hplus0603 15 years, 8 months ago
Hi, how does one program a connection to a computer if it's on its own network that you are not on? That is, a computer with a local address of 192.168.0.2 but an IP address of 68.3.128.4. How do you connect to that computer? I'm using Winsock, not Berkely, but i don't think that matters.
Advertisement
You either do port forwarding from the firewall that does NAT for the private network, or you use a third, "introducer" server to do NAT punch-through. See the Forum FAQ for more details.

Of course, if the private network isn't actually routable to the public internet, then you can't actually get to it -- there needs to be a working connection for the bits to travel through :-)
enum Bool { True, False, FileNotFound };
That's the very best Forum FAQ i've ever seen. Very informative.
However, it did not solve my problem: i am trying to code a program that connects one person's home computer (in a network) to someone else's home computer (in a different network). I don't have the luxury of an external intermediary/introducer server to connect the two computers together-- both computers are behind NAT. Is there any hope?
http://www.google.com/search?hl=en&q=port+forwarding&btnG=Google+Search

[google]
The only hope you have is if the networks/routers have set up port forwarding for the service in question.
enum Bool { True, False, FileNotFound };
I don't know a lot about it, but windows comes with "remote assistance"
I've never used it before but I'm assuming it allows people behind routers to use it with out setting it up for port forwarding. If that's the case then there must be another way of doing this?
please someone correct me if I'm wrong on this.
Quote:Original post by A dam
I don't know a lot about it, but windows comes with "remote assistance"
I've never used it before but I'm assuming it allows people behind routers to use it with out setting it up for port forwarding. If that's the case then there must be another way of doing this?
please someone correct me if I'm wrong on this.

You're wrong on this. Remote Assistance can use uPNP to setup port forwarding, and can connect in either direction, but it's not magic. If both parties have NAT gateways and neither one supports uPNP, you're hosed.
Quote:Original post by Sneftel
You're wrong on this. Remote Assistance can use uPNP to setup port forwarding, and can connect in either direction, but it's not magic. If both parties have NAT gateways and neither one supports uPNP, you're hosed.


well there i go, assuming Microsoft can do magic tricks again... but with all the horrible and unexplainable things my vista box does, it's hard not to imagine that they hire obscene wizards to write their code.
Quote:Original post by A dam
Quote:Original post by Sneftel
You're wrong on this. Remote Assistance can use uPNP to setup port forwarding, and can connect in either direction, but it's not magic. If both parties have NAT gateways and neither one supports uPNP, you're hosed.


well there i go, assuming Microsoft can do magic tricks again... but with all the horrible and unexplainable things my vista box does, it's hard not to imagine that they hire obscene wizards to write their code.


Joel did an intern project last year that was aimed at solving the randevous problem. They host the server to make that happen.
Quote:Original post by A dam
well there i go, assuming Microsoft can do magic tricks again... but with all the horrible and unexplainable things my vista box does, it's hard not to imagine that they hire obscene wizards to write their code.
Now, to be fair, they DO do the UPNP trick, which is almost magic. More and more routers are shipping with it defaulting to enabled, so any software which would like to do port forwarding should probably be trying UPNP.

This topic is closed to new replies.

Advertisement