On 19/06/2010, at 4:42 AM, Steve McKay wrote:

Surely this is a typo. If the IP address was 10.20.30.40 (for example), how
would I get the IP address into a BINARY(4) field?

One is a character representation of a number and the other is a number. Each part of a dotted decimal address will, when converted to a number, fit in 1 byte (i.e., 0 to 255) and therefore four of them will fit in four bytes.

The standard way of doing this is to use a socket support API:
o inet_addr()
or (if supplied)
o inet_aton()
or (preferred)
o inet_pton()

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.