Re: How to get an IP address from network interfaces

2022-04-22 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Apr 22, 2022 at 03:46:01PM +, IGotD- via Digitalmars-d-learn wrote: > On Friday, 22 April 2022 at 12:58:24 UTC, H. S. Teoh wrote: > > > > Why would you not want to use OS APIs? > > > > 1. Portability Usually when portability matters, you already have specific OSes that you're

Re: How to get an IP address from network interfaces

2022-04-22 Thread IGotD- via Digitalmars-d-learn
On Friday, 22 April 2022 at 12:58:24 UTC, H. S. Teoh wrote: Why would you not want to use OS APIs? 1. Portability 2. Language APIs are usually much better to use that the OS APIs, like Berkeley sockets for example.

Re: How to get an IP address from network interfaces

2022-04-22 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Apr 22, 2022 at 09:26:13AM +, IGotD- via Digitalmars-d-learn wrote: > On Thursday, 21 April 2022 at 07:20:30 UTC, dangbinghoo wrote: > > > > [... Berkley sockets network code ...] > > > > It really makes me sad when I see this. D has some native networking > API but unfortunately

Re: How to get an IP address from network interfaces

2022-04-22 Thread IGotD- via Digitalmars-d-learn
On Thursday, 21 April 2022 at 07:20:30 UTC, dangbinghoo wrote: [... Berkley sockets network code ...] It really makes me sad when I see this. D has some native networking API but unfortunately you have go to the OS API to have this basic functionality. D should really expand its own API

Re: How to get an IP address from network interfaces

2022-04-21 Thread dangbinghoo via Digitalmars-d-learn
On Friday, 22 April 2022 at 05:28:52 UTC, dangbinghoo wrote: On Thursday, 21 April 2022 at 07:38:04 UTC, Alexander Zhirov wrote: [...] ```d struct ifreq { private union ifr_ifrn_ { char[IFNAMSIZ] ifrn_name; /* if name, e.g. "en0" */ }

Re: How to get an IP address from network interfaces

2022-04-21 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 21 April 2022 at 07:38:04 UTC, Alexander Zhirov wrote: On Thursday, 21 April 2022 at 07:20:30 UTC, dangbinghoo wrote: On Thursday, 21 April 2022 at 07:04:18 UTC, Alexander Zhirov wrote: I want to get the IP address of the network interface. There is both a wireless interface and a

Re: How to get an IP address from network interfaces

2022-04-21 Thread Alexander Zhirov via Digitalmars-d-learn
On Thursday, 21 April 2022 at 07:20:30 UTC, dangbinghoo wrote: On Thursday, 21 April 2022 at 07:04:18 UTC, Alexander Zhirov wrote: I want to get the IP address of the network interface. There is both a wireless interface and a wired one. Is it possible, knowing the name of the network

Re: How to get an IP address from network interfaces

2022-04-21 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 21 April 2022 at 07:20:30 UTC, dangbinghoo wrote: On Thursday, 21 April 2022 at 07:04:18 UTC, Alexander Zhirov wrote: I want to get the IP address of the network interface. There is both a wireless interface and a wired one. Is it possible, knowing the name of the network

Re: How to get an IP address from network interfaces

2022-04-21 Thread dangbinghoo via Digitalmars-d-learn
On Thursday, 21 April 2022 at 07:04:18 UTC, Alexander Zhirov wrote: I want to get the IP address of the network interface. There is both a wireless interface and a wired one. Is it possible, knowing the name of the network interface, to get its IP address? ```d import

How to get an IP address from network interfaces

2022-04-21 Thread Alexander Zhirov via Digitalmars-d-learn
I want to get the IP address of the network interface. There is both a wireless interface and a wired one. Is it possible, knowing the name of the network interface, to get its IP address?