× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I tried this - neat stuff. It returned the host name only if it was in our host table (sorry, Rob<g>) or in a DNS I've specified. So I suspect something to do with your internal DNS or the host table of the 400 - the API does not go to the machine of that address. Did the machine's name change with the upgrade to XP?

HTH

Vern

At 09:57 PM 6/18/2003 -0500, you wrote:
I have an RPG program I copied from Midrange (thank you Scott Klement ) using the gethostbyaddr API and it worked well on my W2k machines. I have upgraded my machines to XP and the program no longer returns the host name. I have the latest patches applied (06/18/2003).

Jon Giles

hdebug dftactgrp( *no ) bnddir( 'QC2LE' )
Dinet_addr        PR            10U 0 ExtProc('inet_addr')
D  IPAddr                         *   Value options(*string)

DGetHostByAddr    PR              *   ExtProc('gethostbyaddr')
D  HostEnt                      10U 0
D  AddrLen                      10I 0 Value
D  AddrType                     10I 0 Value

DHostEntP S *

Dhostent          DS                   Based(HostEntP)
D  h_name                         *
D  h_aliases                      *
D  h_addrtype                    5I 0
D  h_length                      5I 0
D  h_addr_list                    *

DIP32Addr         S             10U 0
DAF_INET          C                   Const(2)
C     *Entry        PList
C                   Parm                    P#IPAddress      15
C                   Parm                    P#IPName         64

 * Convert IP to binary format:
C                   Eval      IP32Addr  =  inet_addr(P#IPAddress)

* do reverse DNS lookup:

C                   Eval      HostEntP = gethostbyaddr(IP32Addr :
C                                                     %size(IP32Addr) :
C                                                     AF_INET)

* set results

C                   if        HostEntP  = *Null
C                   Eval      P#IPName  = 'Host not found!'
C                   Else
C                   Eval      P#IPName  = %str(h_name)
C                   endif
C                   SetOn                                        Lr
C                   Return



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.