Archived

This topic is now archived and is closed to further replies.

IP Addresses and NAT

This topic is 5966 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I guess we all know that if you''re behind an NAT router that it''s almost impossible to get your IP address. I want to make a combobox that shows *all* available IP-addresses available on someone''s machine. (Like ServeU does, if some people use it here)... But I just can''t get the correct IP address. I''ve made an small HTML file that uses an Apache webserver variable to get the IP address. But this is just overkill. It should be a lot easier to do so then letting the users visit an website to find out their correct IP. Now I thought about using the "GetIpAddrTable" API call, but it will only return "192.168.0.4", and "127.0.0.1". Again no external IP address. Since many people are using Winsock (API) here, I wonder if someone is able to get it correctly? I''m using VB, but C++ Winsock is identical to VB... Almar

Share this post


Link to post
Share on other sites
Well, the only reliable way to get their external IP address is by using some type of server that just sends it back to the machine. You can look into SNMP to query routes along the way to find their external IP, but that''s not 100% reliable as not all NAT devices support SNMP.

Share this post


Link to post
Share on other sites
Well, my question then is why do you need to know their external IP address? If they''re behind a NAT gateway and are going to be hosting a game, then it''s the client that needs to know that external IP address. All the person running the server needs to do is forward the specific ports correctly on their NAT gateway.

If they are going to be a client then their external IP address isn''t really important to them either.

Share this post


Link to post
Share on other sites
Well, it''s more because of a (confirmed) bug in DX8.0(a).
If my masterserver retrieves the IP address of the connecting gameserver, it will give "192.168.0.4" for me... even if you''re connecint really over the internet, through an router. Now if the masterserver would send this to the clients, it would be an useless IP... since the client will try to connect to their own network IP(''s).

I already made an ''override textbox''... but I rather have it filled in correctly, so the user can select the correct IP immediatly. It ain''t crucial though..

The bug is fixed in DX8.1... but then everybody has to download DX8.1.. even an worse option

(btw: I''ll be away for a few days, I cannot reply on this topic )

Almar

Share this post


Link to post
Share on other sites
http://msdn.microsoft.com/library/default.asp?URL=/library/techart/Nats2-msdn.htm

I''m assuming you''ve looked at that. If there is a confirmed bug in DP8, then I really think requiring DX8.1 would be a better solution than anything I can come up with for getting your external IP address. I just wouldn''t want to have to run a web server returning the client IP address just to work around a bug in DP8.

Share this post


Link to post
Share on other sites
Yeah, I''ve seen that article... The Client/Server can connect perfectly, the only problem is the IP address.

Well, I''ll just leave that textbox in so that users can still ''override'' their network IP address. And later I''ll just remove it, and compile a version with DX8.1 which does it all automatically. Since DX8.1 isn''t released yet, it looks like the best solution for me.

Thanks,
Almar

Share this post


Link to post
Share on other sites