Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jun 2000 13:24:58 +0200 (CEST)
From:      Bernhard Rosenkraenzer <bero@redhat.de>
To:        Willem Brown <willem@brwn.org>
Cc:        redhat-list@redhat.com, Alan Mead <amead8695@home.com>, freebsd-questions@freebsd.org
Subject:   Re: Someone is still stalking me with spam
Message-ID:  <Pine.LNX.4.21.0006081312050.4033-100000@bochum.redhat.de>
In-Reply-To: <20000608131114.B3846@denary.brwn.org>

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.21.0006081312050.4033-100000>