× 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: IP address calculation for sockets
  • From: Buck Calabro <Buck.Calabro@xxxxxxxxxxxx>
  • Date: Mon, 16 Apr 2001 16:16:07 -0400

Rambabu Kalidindi wrote:

>I'm one step forward i.e. i'm getting IPAddr
>values as follows.Suppose when i pass string
>like(www.ibm.COM) 
>IPAddr value is 3504248331.I have no
>idea why is was like that.It should be like
>xxx.xxx.xxx.xxx format.
>How do i convert IPAddr value
>into XXX.XXX.XXX.XXX format.

We can think of the IP address as one long integer 3504248331 or as a
hexadecimal number D0DE960B.  You don't need to convert it to anything to
use it for connect().  If you want to convert it by hand, the easiest way is
to use the hex version (in debug, eval ipaddr:x).  Take each pair of hex
digits and convert them to decimal.  If you are on Windows, you can use the
calculator program.  Start it (Start, Run calc) change it to Scientific
(View, Scientific) and type in the decimal value 3504248331.  Press F5 or
click on the Hex radio button.  You now see the hexadecimal representation
of the number D0DE960B.

Type the first pair of digits D0, press F6 or click Dec radio button to see
the decimal number 208
F5 (Hex), then do the next pair: DE becomes 222
F5, do the next pair: 96 becomes 150
F5 and the final pair: 0B becomes 11
The IP address you gave is 208.222.150.11, or as400.rochester.ibm.com

Buck Calabro
Commsoft; Albany, NY
"Nothing is so firmly believed as
 that which we least know" -- Michel Montaigne
Visit the Midrange archives at http://www.midrange.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 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.