Click here to Skip to main content
15,881,881 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have written an application that is sitting on a computer listening on a certain network port. The problem is that the PC is behind a router that has a NAT that will block any unmapped packets that will arrive.

My application is already sending to a website all the data I need like router external address...(this is done through ASP.NET request variables)
Example: HTTP_X_FORWARDED_FOR 162.17.150.151, 10.0.2.42 and REMOTE_HOST 119.101.93.8 (of course I changed those).
So what I'm trying to do is send data to the router and telling it to which host to forward it exactly like a web server does and I want absolutely no manual configuration for the router because the router is not mine.
Basically I'm trying to establish a peer to peer communication without the need of a third party and I don't see how this is impossible to make.

Please help me and remember that I don't want to make any configuration for the router.
Posted
Updated 16-Apr-10 10:04am
v2

Your application behind the NAT router has to initiate the connection, and keep it open. The external system then has to use that connection to communicate back to the originating system, it can NOT work the other way around without changing the router configuration.

It doesn't matter if a remote system has the information from a previous connection. It cannot initiate a connection at a later time.

Even P2P systems in their configuration say that you need to put port forwarding into NAT routers for the system to work properly.
 
Share this answer
 
v2
Mr. Rod kemp

You said:
Your application behind the NAT router has to initiate the connection, and keep it open. The external system then has to use that connection to communicate back to the originating system...

I understand the concept but what do I have to do programmatically?
What does it mean to initiate the connection and keep it open?
If you have not done that before, can you at least guide me to an article or an open source project?

BTW, I did not know that the router keeps a record of requests from inside the network.
I appreciate your help very much...
 
Share this answer
 
v2
It means just what it means: Open a TCP connection to the remote system, and just leave it open. The remote system can now communicate back to your system through the open channel.

You could also do it through a UDP session, but this is more complicated. You would have to refresh the session periodically, because the router 'forgets' UDP sessions after a (configurable) period of inactivity (and the person who administers the router may have blocked this functionality altogether).

I must warn you that the things you are trying to do look highly suspicious to me, and would be considered a cause for dismissal in most companies. Creating holes in firewalls is a serious breach of security.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900