Click here to Skip to main content
15,887,939 members
Please Sign up or sign in to vote.
5.00/5 (3 votes)
See more:
There are a lot of things I'm trying to understand here. I don't want to read through entire book volumes or articles, just the possible solution to the condition mentioned below. Also, I couldn't find the answer in the forums I have seen. Please direct to me a concise answer if available. The question (I hope) is not dependent on the programming language I am using. Visual C++ can be considered as the language I am using if that is important. So here is my question. Please bear with the length.

I use a network in which I am connected to internet through a proxy. This information was confirmed by me using http://www.whatismyip.com/[^_^]. It showed my external IP and the name of the proxy detected. The external IP never seem to change.

I could make a server program which is hosted in a local computer & could accept connections & do data transfer between other local computers within the LAN using corresponding client program. Since, the IPs of the LAN are assigned by a DHCP server, all the local computers end up having different IPs whenever rebooted. To makes things easier, the server program runs on a particular computer & listens to a particular hard-coded port. The client programs have the computer name of that server computer hard-coded into them. They resolve the IP of the server from the computer name & connect to the particular hard-coded port. I guess the port of the client is assigned by the OS in the client computer. The firewall in the local computer asks permission whenever I start the server program & I always allow it to access all public networks. Firewall never asks permission for my client programs & they work alright. In this context, by server program I mean which can "listen to a port and accept incoming connections" & by client program I mean "which tries to connect to a server program at a particular known computer".

So far I had to deal with a single IP address & a single port that of the server (from programming point of view). From the connection point of view, I had two IPs and their two corresponding ports.

I intend to make a server program that can accept connections (preferably TCP) from outside my local LAN. I have no access to the router. I intend to host the server program in a local computer here. I would like to have the server program do data transfer between a local client and an external client (a client who doesn't have the same external IP as mine). The external client himself might have an external IP and an internal IP. Is this possible? How can it be done? How would the function calls look like? Please provide a code snippet (if possible).

I have used programs like "Ares Galaxy p2p" in the local computers here and seen that they work alright. Even though they do it using a connection manager (I feel so), ultimately they are capable of connecting a remote computer outside my LAN with my local computer. As far as I know, the connection manager program is used only to procure the set of IP addresses of the Computer1 and Computer2 that it is trying to connect. Once the programs at Computer1 and Computer2 has information about each other, they can connect directly (one acting as a server & another as a client for that moment).

In my case, the set of information I claim to have are internal & external IPs of my local computer (which has the server program), internal & external IPs of the client outside who is trying to connect and an arbitrary port address that I can set for the server program.

Articles on "port-forwarding" have not been helpful since I have no access to the router. I would like to know what are the usable ports from outside my LAN through an external checking (like from a website; but so far all the websites I have used show that my ports are all closed; those must be the ports of the proxy sever). Anyways, Ares program is doing the data transfer.

Please give me specific answers to the questions. I hope the problem is well explained (& so many usual background-information-seeking-questions can be avoided :) ). Please correct me if anything stated above seems incorrect to the context.Many of the things which I'm unsure are expressed as statements. Thank You.
Posted

1 solution

Here[^] is an article that describes how Skype and others get around firewalls. Using those techniques should get around your lack of access to the router.

This is unlikely to be the complete solution, but with any luck it will get you started in the right direction.

Another thing that might be worth studying is how ftp passive mode works. Wikipedia is probably a good place to start.

Cheers,
Peter
 
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