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

Stanislav Blinov stanislav.blinov at gmail.com
Tue Feb 4 05:21:53 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)

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.


More information about the Digitalmars-d-learn mailing list