comp.lang.ada
 help / color / mirror / Atom feed
From: ahlan@marriott.org
Subject: Gnat Sockets - Obtaining all the home addresses
Date: Thu, 7 Feb 2019 00:58:44 -0800 (PST)
Date: 2019-02-07T00:58:44-08:00	[thread overview]
Message-ID: <e41c8125-5a1d-475c-89f2-79c0c7a338f0@googlegroups.com> (raw)

My Ada programs need to obtain all the IP4 home addresses of the PC on which they execute.
Not just the first but all of them - it is now common for PCs to have more than one adapter - for example wired Ethernet and Wifi and these can be connected to different networks and therefore have totally different IP4 addresses.
I would like to write the code in an OS independent way and therefore currently use Gnat Sockets
In all the examples I have seen Get_Host_By_Name is called with Host_Name as its parameter.
This returns a Host_Entry_Type from which the function Addresses can obtain the host addresses.
Under Windows Addresses_Length returns the number of active network adapters and Addresses returns all the host addresses.
However on my Mac running Mojave with two network adapters on two different networks Get_Host_By_Name only returns one address.
Is this a bug or am I misunderstanding something?
I haven't tried it out under Linux as all my Linux machines only have one network adapter so maybe the problem isn't limited to Osx.
In any case, if this is not the way to do it - how should I obtain all the home addresses in an OS independent manner?
Can anyone advise me?

Best wishes as always,
MfG
Ahlan


                 reply	other threads:[~2019-02-07  8:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox