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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting by IP through router

Status
Not open for further replies.

cryoburned

Programmer
May 23, 2006
14
US
I need to connect to a computer by its IP Address when that computer is using a router...

Not sure how this needs to be done or if i should have posted it in the VB6 section.. sorry
 
Need more infomration...

Connect to a computer how? ftp? rdp? telnet? etc.

"that computer is using a router", I assume you mean the computer is behind a router.
Is this over a private network or internet?
What kind of router?
Is NAT involved?

Need as much detail as you can give.

MCSE CCNA CCDA
 
Im connecting using winsock.. and the socks are just sending text strings.... and I'm not sure if NAT is involved.. I've heard of it but I don't know what it is.. its just a D-Link Router... not sure about the publicness of it
 
Are both machines hooked into the router? If so, and both get IP addresses automatically, and both are on the same workgroup, you should be able to communicate. Also requires file and printer services under networking and something shared somewhere.

Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
Need to know what TCP port your program is using to send "text strings".
Say, for instance, your are using telnet. That's TCP port 23.
The router would have to be configured to forward port 23 to the local IP address of the computer.
Then, you would use the router's outside (public) interface IP address to connect to the computer.

MCSE CCNA CCDA
 
It sounds as if you are trying to use Winsock in a VB program to connect to a remote system based on its IP address rather than its DNS name. If that is the case, it is no different than using the DNS name IIRC. Just use the dotted octet IP address as the string to use for the connection and I believe that Winsock "figures it out" that you are using an IP rather than a name. It will skip the whole DNS request/reply phase of the connection setup and send a request to the gateway to find the IP address.

NAT and a router only make a difference if the machine using NAT behind the router is the destination of your connection. If so there are a couple of things that you need to establish before attempting the connection: 1) you need the NAT's resolvable IP address, not the address of the actual destination computer; 2) you need to set up port redirection on the router that is doing the NAT, so that it knows when your connection request comes in from the Internet to port X that it should actually map that connection to the computer behind the firewall using the actual IP address of the destination computer at port x (doesn't have to be the same port number).

Since it appears that you may be unfamiliar with IP networking in general, I would suggest that you not use any port number less than 1024 (traditionally privileged ports) and avoid any standard port numbers, since they may be scanned as a function of the vulnerabilities on that port (actually attributed to the well-known application using that port).

Take a look at this page for well-known port numbers:

You may also want to avoid 1025 - 5000 since they are dynamically assigned by Windows for outgoing connections. There are, however, many services in this range.


pansophic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top