Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sockets with a router.

Status
Not open for further replies.

hedgefighter

Programmer
Oct 5, 2006
5
US
To make a socket you have to specify an IP address to connect to, correct? But what if you are trying to connect to a specific computer that is connected to a router with that IP address?
 
This is more of an IT Question but I'll answer it for you anyways.

What you want to do is also set the port that you are connecting to. Then on the router (with that ip) you have to set up port forwarding.


Computer1 ---- Internet ---- Router --- Port 9000 (Computer2)
|---Port 9001 (Computer3)
|---Port 9050 (Computer4)


You can define which port forwards to which internal ip. I recommend you look at the manufacturer's website for the router to find out how to set up port forwarding.
 
Ok, let me rephrase the question. I want someone to come to my web server via http and then I want to make a socket connection to their computer on a specific port. I know how to do this given the client's IP address, but when the client is behind a router how do I make the socket connection? I won't have access to the client's router so port forwarding isn't an option.
 
That would defeat the purpose of a router/firewall.

You might be able to get in on a common port like port 21 (FTP) but they still have to have that directed somewhere. The other option would be for them to connect to you rather than you connecting to them. This would involve a client on their computer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top