|
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 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.