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


  • Subject: RE: inet_addr API question
  • From: Chris Bipes <rpg@xxxxxxxxxxxxxxx>
  • Date: Thu, 4 May 2000 08:24:20 -0700

Here is what I used and it works just fine.

D TcpAddr                       16a   inz('10.1.1.0') 
 *---------------------------------------------------------
 * Prototype for InetAddr().                               
 *---------------------------------------------------------
D InetAddr        PR            10i 0 ExtProc('inet_addr') 
D                               16a                        

C                   EVAL      SocketId = %Trim(TcpAddr) + x'00'
C                   EVAL      rc =inetaddr(SocketId)           

Christopher K. Bipes     mailto:ChrisB@Cross-Check.com
Sr. Programmer/Analyst   mailto:Chris_Bipes@Yahoo.com
CrossCheck, Inc.         http://www.cross-check.com
6119 State Farm Drive    Phone: 707 586-0551 x 1102
Rohnert Park CA  94928 Fax: 707 586-1884

If consistency is the hobgoblin of little minds, only geniuses work here.
Karen Herbelin - Readers Digest 3/2000


-----Original Message-----
From: Paul Jackson [mailto:paulgjackson@yahoo.com]
Sent: Wednesday, May 03, 2000 4:21 PM
To: RPG400-L@midrange.com
Subject: inet_addr API question


Greetings sockets & API gurus,

I am trying to use the "inet_addr" sockets api to
convert a dotted decimal IP address into a 4 byte
integer.
My confusion lies in the fact that the documentation
for the API specifies an unsigned integer as the
return value.  The documentation also specifies that
the return value will be set to -1 if there is an
error on the call to the API.

The example in the new RPG redbook on page 197,
specifies the prototype return value as 10U 0 as per
the documentation and also mentions -1 as an error
return value.

My question is, how can you test for -1 on an unsigned
integer field? and if this is just incorrect
documentation of the API? Also if I make the return
variable a signed integer, then I sometimes get
overflow errors when translating test IP address such
as 255.255.255.255.

I look forward to hearing any comments relating to
this problem.

Paul Jackson
Systems Programmer/Analyst
Costco Wholesale
Issaquah, WA USA
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-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.