From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:e387:: with SMTP id d129mr5424734ith.40.1549529924664; Thu, 07 Feb 2019 00:58:44 -0800 (PST) X-Received: by 2002:a9d:654f:: with SMTP id q15mr121842otl.6.1549529924556; Thu, 07 Feb 2019 00:58:44 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!q69no113182itb.0!news-out.google.com!v71ni132ita.0!nntp.google.com!k10no113193itk.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 7 Feb 2019 00:58:44 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:1205:506c:ddf0:31c9:9d0e:f01e:9609; posting-account=DQbqYQoAAACn8hHn2LmG2aF7Mhbxl_Lf NNTP-Posting-Host: 2a02:1205:506c:ddf0:31c9:9d0e:f01e:9609 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Gnat Sockets - Obtaining all the home addresses From: ahlan@marriott.org Injection-Date: Thu, 07 Feb 2019 08:58:44 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:55455 Date: 2019-02-07T00:58:44-08:00 List-Id: 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