Re: [Opentnl-general] Finding the address of /this/ end of a connection
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <ma...@ga...> - 2005-04-30 23:26:20
|
>Ok, thanks, but that doesn't give the port, which wouldn't >distinguish between possibly many connections from the same >machine. > > All NetConnections on a NetInterface share the same port. To accurately determine the port for a NetInterface, you should use the NetInterface's getSocket() method, and then call getBoundAddress on the socket. This will give you at least an accurate port. The address may be Address::Any if it wasn't specified which hardware interface the NetInterface should bind to. So you can use the combination of Socket::getInterfaceAddresses and NetInterface::getSocket().getBoundAddress() to determine the port. |