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

TheFlyingFiddle theflyingfiddle at gmail.com
Tue Feb 4 05:29:16 PST 2014


On Tuesday, 4 February 2014 at 13:13:07 UTC, Dicebot 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)
>
> You can have lot of different local IP addresses on a single 
> machine so question can't be answered properly. However you may 
> use in `Socket.hostName` and resolve it via DNS to find IP 
> machine itself currently consuders as its main pulbic IP.

This works great thanks. I just need any (working) local IP 
address so getting more then one is not an issue for me.


More information about the Digitalmars-d-learn mailing list