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

TheFlyingFiddle theflyingfiddle at gmail.com
Tue Feb 4 05:31:26 PST 2014


On Tuesday, 4 February 2014 at 13:21:54 UTC, Stanislav Blinov 
wrote:
> On Tuesday, 4 February 2014 at 13:02:26 UTC, TheFlyingFiddle 
> wrote:
>> I'm trying to find my own ip address using std.socket with 
>> little success. How would i go about doing this? (It should be 
>> a AddressFamily.INET socket)
>
> 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. You cannot really do that before 
> establishing a connection, as Dicebot already mentioned.

Problem is that i don't know in what local network the server 
will be running, so this is unfortunatly not an option for me.


More information about the Digitalmars-d-learn mailing list