Re: [asio-users] How to obtain local ip /localhost ip of machine on LAN
Brought to you by:
chris_kohlhoff
From: Simon P. <sim...@vi...> - 2008-10-23 12:49:37
|
Jamie Allsop wrote: > I know this has benn brought up several times before. What I am looking > for is a suggestion on how to obtain the external LAN ip of the local > machine. You need to better define what you want. What if your machine has two addresses? What if they're on different networks? What if they're on the same? What if the machine doesn't have a default route? Do you want: - The addresses assigned to the interfaces? If yes, look at ifaddrs.h. - The address used as source when sending a packet to a particular IP? If yes, create a UDP socket, connect() it to the remote address, and then look at its local_endpoint(). - Something else? -- Please try Numb, a STUN/TURN server implementation. Free access at http://numb.viagenie.ca/. |