From owner-freebsd-questions Wed Jul 12 15:50:40 2000 Delivered-To: freebsd-questions@freebsd.org Received: from unix.megared.net.mx (megamail.megared.com.mx [200.52.207.52]) by hub.freebsd.org (Postfix) with ESMTP id D135437BF17 for ; Wed, 12 Jul 2000 15:50:36 -0700 (PDT) (envelope-from ales@megared.net.mx) Received: from ales (ales.corp.megared.net.mx [200.52.193.2]) by unix.megared.net.mx (8.9.3/8.9.3) with SMTP id RAA16670; Wed, 12 Jul 2000 17:47:13 -0500 (CDT) (envelope-from ales@megared.net.mx) Message-ID: <00c801bfec53$243d48a0$02c134c8@megared.net.mx> From: "Alejandro Ramirez" To: "Raymundo M. Vega" , "Stephen Hovey" , "Rahul Siddharthan" , "Jan Grant" , "Theo Bell" Cc: References: <396CCC00.1320965@home.com> Subject: Re: IP Address Convertion Formula??? Date: Wed, 12 Jul 2000 17:47:21 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > > > Oh I think easy is always proper! :) > > > > unless you *really* want to know how it is done That is exacly what I wanted to know, basically its very simple: Quote from Andresen,Jason R. Both of them represent 32 bits. Your first form simply leaves all of the bits together to form a single 32 bit number, the second form breaks the bits up into four 8 bit numbers. Example: 10.10.35.158 = 00001010.00001010.00100011.10011110 = 00001010000010100010001110011110 = 168436638 = 10.10.35.158 It is a "feature" of the BSD-derived inet_aton() function. Originally, the function was supposed to convert the shorthand "12.1" into the corresponding 32-bit IPv4 binary address for 12.0.0.1. It also converts things w/o dot like "121" into 0.0.0.121. That way, it also converts the what I call big-int addresses like "168436638 " into 10.10.35.158. As digit strings are always network byteorder, the conversion is not affected by endianess issues. Thanks to all who helped me with this... Sincerely Ales To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message