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

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


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.


More information about the Digitalmars-d-learn mailing list