Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jun 2000 17:46:06 +0200
From:      Willem Brown <willem@brwn.org>
To:        Bernhard Rosenkraenzer <bero@redhat.de>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Someone is still stalking me with spam
Message-ID:  <20000608174606.C3846@denary.brwn.org>
In-Reply-To: <Pine.LNX.4.21.0006081312050.4033-100000@bochum.redhat.de>; from bero@redhat.de on Thu, Jun 08, 2000 at 01:24:58PM %2B0200
References:  <20000608131114.B3846@denary.brwn.org> <Pine.LNX.4.21.0006081312050.4033-100000@bochum.redhat.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <stdio.h>
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000608174606.C3846>