|
|
Subject:
How to determine if a connection/socket is comming in thru NAT with a socket
Category: Computers > Programming Asked by: davidlpotter-ga List Price: $30.00 |
Posted:
16 Aug 2006 06:49 PDT
Expires: 15 Sep 2006 06:49 PDT Question ID: 756565 |
Ok my question is, After I do an accept is there a way to tell if a socket has come thru a NAT. My problem is I want to do multiple connections from behind the NAT, and I need to know the local address(192.168...)so I can tell they are comming from different clients. I know I could send that local address as a message after connection, but I need it at connection, can I get that from the socket somehow? Here is the code I use to get the ipaddress of a socket, but that gives me back the ip address of the router, not the local address. sockaddr_in addr1; sockaddr_in *addr2 = 0; int nVal = 0; int len = sizeof(SOCKADDR_IN); nVal = getpeername(nSocket,(struct sockaddr *)&addr1,&len); return inet_ntoa(addr1.sin_addr); Thanks David | |
|
|
There is no answer at this time. |
|
Subject:
Re: How to determine if a connection/socket is comming in thru NAT with a socket
From: davidleepotter-ga on 22 Aug 2006 10:11 PDT |
Yes I need to do this, my client connect to a server and creates a client based off of the ip address. Now if a person starts 2 clients from diff computers behind the firewall, I will get 2 connections from the same ip address causing a conflict. |
Subject:
Re: How to determine if a connection/socket is comming in thru NAT with a socket
From: zmaster_zhang-ga on 03 Sep 2006 20:36 PDT |
Only programing in client or server is not enough. You should see this page http://www.brynosaurus.com/pub/net/p2pnat/ If you want to soucercode you may touch me. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |