How can i find my LAN IP Address using std.socket?

Dicebot public at dicebot.lv
Tue Feb 4 05:24:58 PST 2014


On Tuesday, 4 February 2014 at 13:21:54 UTC, Stanislav Blinov 
wrote:
> Create a connection to another LAN machine with a known address 
> (e.g. gateway or router), then use Socket's localAddress 
> property to get your IP.

Worth noting that this solution is not reliable in general either 
because your server can possibly have complicated routing 
configurations that will make, for example, LAN destination 
packets go via different network interface than WAN destination 
ones.

It is probably better to tell what high-level problem you are 
trying to solve to find most useful compromise.


More information about the Digitalmars-d-learn mailing list