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



KRR,

Here is a brief sample that seems to do what you want:

     D*
     D* Compile with:
     D* CRTBNDRPG PGM(xxxxxxx) DFTACTGRP(*NO)
     D*
     DGetHost          PR              *   EXTPROC('gethostbyaddr')
     D                               10u 0
     D                               10i 0 VALUE
     D                               10i 0 VALUE
     DInetAddr         PR            10u 0 EXTPROC('inet_addr')
     D                               16
     D*
     DH_Errno          PR              *   EXTPROC('__h_errno')
     D*
     DAF_INET          S             10i 0 INZ(2)
     Diaddress         S             10u 0
     Dcaddress         S             16    INZ('13.13.13.13')
     DHostPtr          S               *
     Dhost_name        S             50    BASED(h_name)
     Derrno_val        S             10I 0 BASED(errno_ptr)
     Derrno_ptr        S               *
     Dhostent          DS                  BASED(HostPtr)
     D h_name                          *
     D h_aliases                       *
     D h_addrtype                    10i 0
     D h_length                      10i 0
     D h_addr_lst                      *
     C*
     C* Get 32 bit IP address form dotted decimal format
     C*
     C     caddress      cat       x'00':0       caddress
     C                   eval      iaddress = InetAddr(caddress)
     C*
     C* Get Host name
     C*
     C                   eval      HostPtr = GetHost(iaddress
     C                                               : %SIZE(iaddress)
     C                                               : AF_INET)
     C                   if        HostPtr <> *NULL
     C*
     C* If successful:
     C*
     C     host_name     dsply
     C*
     C                   else
     C*
     C* If failure, display H_Errno value (see QSYSINC/H NETDB)
     C*
     C     'NOT FOUND'   dsply
     C                   eval      errno_ptr = H_Errno
     C     errno_val     dsply
     C                   endif
     C*
     C                   move      '1'           *inlr
     C                   return

Bruce Vining

>
>Hi,
>
> I am working on some RPGIV sockets code and am having   a problem using
>"gethostbyaddr".  I am giving the  procedure a pointer to the IP address
>field, the IP  address length, and the address type.  The return from
>this procedure gives me a *NULL for the pointer.  Any   suggestions
>and/or samples would be greatly   appreciated.
>
>Thanks,
>KRR
>

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.