× 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: inet_addr API question
  • From: Paul Jackson <paulgjackson@xxxxxxxxx>
  • Date: Wed, 3 May 2000 16:21:20 -0700 (PDT)

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

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
+---
| 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-Ups:

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.