Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

A router exposes itself to outside by IP like 66.249.89.104 and many hosts can connect to it to form a Local Area Network.

My question :

Is there a way to identify a specific host in that LAN?

All I tried is some guessing work which fails with no doubt:

ping host_lan_ip@66.249.89.104
Ping request could not find host host_lan_ip@66.249.89.104. Please check the name and try again.

I think since each host in LAN can get their packets from outside the router,there MUST be a way to identify each host,but what's that?

UPDATE How to achieve Port forwarding except configuring it in the router?

UPDATE

Now I think UPnP is the way to go,but is there a working sample for this?

share|improve this question

migrated from stackoverflow.com Oct 13 '10 at 6:11

This question came from our site for professional and enthusiast programmers.

    
I don't think your ping command (Windows) is valid: host_lan_ip@66.249.89.104? –  eee Oct 11 '10 at 6:49
    
Yeah, but so far no working demo yet. –  justnobody Oct 11 '10 at 6:55

1 Answer 1

You cannot initiate a connection into a router. The internal host must begin by forwarding a port to itself, and then listening on that port.

UPnP is the way to go for setting up the port forwards. Then you have to address the problem of which port, if you want to talk to several clients behind the same NAT they can't all use the same port so you need some way to know which client is using which port. A central server which the clients can list themselves on is usually the way to do this (like games servers being listed in a lobby, the master server keeps track of IP/port so everyone else can connect)

A quick google search turned up a C++ UPnP library which might be worth giving a go:

http://www.koders.com/cpp/fid2A3FF8255A7B67758E80E0423AA46F9DD8FD734A.aspx?s=setwindowshookex

and the windows UPnP API:

http://msdn.microsoft.com/en-us/library/aa382303%28VS.85%29.aspx

share|improve this answer
    
Is there a working sample of UPnP available? –  justnobody Oct 12 '10 at 2:51
    
I had a look for one. I found a couple of ok looking ones, proper googling might find some better ones. See my answer for the links. –  Martin Oct 12 '10 at 10:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.