From owner-freebsd-questions Thu Jun 8 8:46:30 2000 Delivered-To: freebsd-questions@freebsd.org Received: from snoopy.brwn.org (intgw1.brwn.org [196.28.127.66]) by hub.freebsd.org (Postfix) with ESMTP id 89DB937C033 for ; Thu, 8 Jun 2000 08:46:16 -0700 (PDT) (envelope-from willem@denary.brwn.org) Received: from denary.brwn.org (denary.brwn.org [192.168.1.17]) by snoopy.brwn.org (Postfix) with ESMTP id 9DED23ACF; Thu, 8 Jun 2000 17:46:08 +0200 (SAST) Received: (from willem@localhost) by denary.brwn.org (8.9.3/8.9.3) id RAA05740; Thu, 8 Jun 2000 17:46:06 +0200 (SAST) (envelope-from willem) Date: Thu, 8 Jun 2000 17:46:06 +0200 From: Willem Brown To: Bernhard Rosenkraenzer Cc: freebsd-questions@freebsd.org Subject: Re: Someone is still stalking me with spam Message-ID: <20000608174606.C3846@denary.brwn.org> References: <20000608131114.B3846@denary.brwn.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: ; from bero@redhat.de on Thu, Jun 08, 2000 at 01:24:58PM +0200 X-Public-Key: http://www.brwn.org/~willem/pubkey.txt Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, Thanks, I learned a couple of new things from this. As an exercise I wrote the opposite of it. I'm trying to learning C. Regards Willem Brown On Thu, Jun 08, 2000 at 01:24:58PM +0200, Bernhard Rosenkraenzer wrote: > On Thu, 8 Jun 2000, Willem Brown wrote: > > > > > http://3454552827/users/nfc4/teen5.html > > > > I don't want to sound stupid, how does this, '3454552827', get translated to > > an ip address? > > An IP address is basically just 4 bytes in a row, where a byte consists of > 8 bits (each of which can be only 0 or 1). > The normal way of reading an IP address is keeping each byte separate, > i.e. reading > 00000001 00000010 00000011 00000100 > as 4 completely different entities by converting each of these binary > numbers to decimal and separating them with dots (the above would be > 1.2.3.4). > It is just as valid to read them as one large number > 00000001000000100000001100000100 > Which is a completely different large number in decimal - but address-wise > they're the same. > > The simplest way to make them readable is > > #include > main() > { > unsigned long l=htonl(3454552827); > unsigned char *s=(unsigned char *)&l; > printf("%u.%u.%u.%u\n", s[0], s[1], s[2], s[3]); > } > > LLaP > bero > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > > -- /* =============================================================== */ /* Linux, FreeBSD, NetBSD, OpenBSD. The choice is yours. */ /* =============================================================== */ Everybody is ignorant, only on different subjects. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message