< Previous by Date | Date Index | Next by Date > |
< Previous in Thread | Thread Index | Next in Thread > |
On 6/25/12 08:31, Jun 25, Karlsson
wrote:
I have a question, if the application run on a PC which has two NICs, one is connected to the internet(A NIC), another one connected to a LAN(B NIC), how can the application detect the internet connection NIC IP(A NIC) and put it into SDP automatically? There's the simple and wrong way; and then there's the complex and right way. The simple and wrong way involves (if my memory serves) creating a UDP socket; doing a "connect()" call to an address on the internet; and then querying the socket for its locally bound address using "getsockname()". The correct way that works in arbitrary configurations (What if you have three interfaces? What if you have a VPN up? What if the other machine is on the same LAN as you? What if you're behind a NAT and so is your partner?) is using ICE. See http://tools.ietf.org/html/rfc5245 and http://tools.ietf.org/html/rfc5768 for details on how ICE works. There is an ICE implementation in the resiprocate tree under the "nICEr" directory, although the interface appears to be a bit rough at the moment. /a |