inet:ip/1

James Cloos <>
Thu Apr 13 02:10:18 CEST 2006


>>>>> "Serge" == Serge Aleynikov <> writes:

Serge> While playing with the inet:ip/1 function I noticed that it can take
Serge> an argument containing less than four octets.  What's the meaning of
Serge> such a strange conversion like inet:ip("1.2.3")?

The RFC for ipv4 defines all of:

    a.b.c.d
    a.b.e
    a.f
    g

as identical, where e=256c+d, f=256b+e and g=256a+f.

The idea was that in a class A (now called a /8) you could just use a.1
through a.16777214 (if I got the math right), in a class B a.b.1 thru
a.b.65534 and in a class C a.b.c.1 thru a.b.c.254.

Some of the more recent RFCs try to deprecate that syntax, but it
hangs on in most resolvers.

-JimC
-- 
James H. Cloos, Jr. <>



More information about the erlang-questions mailing list