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

2024-02-18 Thread cc via Digitalmars-d-learn
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) On Windows, you can use the Win32`GetAdaptersInfo`[1] function to get a

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

2024-02-17 Thread Forest via Digitalmars-d-learn
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) Sadly, the standard library doesn't seem to offer network interface

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

2023-02-21 Thread Mike Shah via Digitalmars-d-learn
On Tuesday, 4 February 2014 at 22:31:53 UTC, Dicebot wrote: On Tuesday, 4 February 2014 at 20:19:14 UTC, TheFlyingFiddle wrote: I'm setting up a simple local network enabling me to connect phones to the computer through the local wi-fi. The simplest way i could think of to make this work

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

2014-02-04 Thread TheFlyingFiddle
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)

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

2014-02-04 Thread Dicebot
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

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

2014-02-04 Thread Stanislav Blinov
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.

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

2014-02-04 Thread Dicebot
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

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

2014-02-04 Thread TheFlyingFiddle
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

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

2014-02-04 Thread TheFlyingFiddle
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)

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

2014-02-04 Thread Stanislav Blinov
On Tuesday, 4 February 2014 at 13:31:27 UTC, TheFlyingFiddle wrote: 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. But if that's the case, the hostname solution may as well just give you your loopback address. :)

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

2014-02-04 Thread Craig Dillabaugh
On Tuesday, 4 February 2014 at 15:48:50 UTC, Vladimir Panteleev 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)

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

2014-02-04 Thread Dicebot
On Tuesday, 4 February 2014 at 16:02:33 UTC, Craig Dillabaugh wrote: However if I run /sbin/ifconfig I get: enp7s0Link encap:Ethernet HWaddr 50:E5:49:9B:29:49 inet addr:10.1.101.52 Bcast:10.1.101.255 Mask:255.255.255.0 inet6 addr: fe80::52e5:49ff:fe9b:2949/64

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

2014-02-04 Thread Vladimir Panteleev
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) This program will print all of your computer's IP addresses: import

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

2014-02-04 Thread Dicebot
On Tuesday, 4 February 2014 at 16:13:33 UTC, Dicebot wrote: It results in all addresses you hostname resolvs to. On all desktop linux machines /etc/hosts is configured to resolve hostname to localhost by default. On servers it usually resolves to externally accessible one. Update: I have

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

2014-02-04 Thread Stanislav Blinov
On Tuesday, 4 February 2014 at 16:02:33 UTC, Craig Dillabaugh wrote: This computer is on a network with dynamically assigned IP address (DHCP). So shouldn't the 10.1.101.52 address have been reported? Nope. In out-of-the-box simple network setups (i.e. home network in the form PC/laptop -

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

2014-02-04 Thread Craig Dillabaugh
On Tuesday, 4 February 2014 at 16:13:33 UTC, Dicebot wrote: On Tuesday, 4 February 2014 at 16:02:33 UTC, Craig Dillabaugh wrote: However if I run /sbin/ifconfig I get: enp7s0Link encap:Ethernet HWaddr 50:E5:49:9B:29:49 inet addr:10.1.101.52 Bcast:10.1.101.255

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

2014-02-04 Thread TheFlyingFiddle
On Tuesday, 4 February 2014 at 13:24:59 UTC, Dicebot wrote: On Tuesday, 4 February 2014 at 13:21:54 UTC, Stanislav Blinov wrote: Worth noting that this solution is not reliable in general either because your server can possibly have complicated routing configurations that will make, for

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

2014-02-04 Thread Johannes Pfau
Am Tue, 04 Feb 2014 16:19:08 + schrieb Stanislav Blinov stanislav.bli...@gmail.com: On Tuesday, 4 February 2014 at 16:02:33 UTC, Craig Dillabaugh wrote: This computer is on a network with dynamically assigned IP address (DHCP). So shouldn't the 10.1.101.52 address have been

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

2014-02-04 Thread Dicebot
On Tuesday, 4 February 2014 at 20:19:14 UTC, TheFlyingFiddle wrote: I'm setting up a simple local network enabling me to connect phones to the computer through the local wi-fi. The simplest way i could think of to make this work without relying on an external server was to simply broadcast the