User Tools

Site Tools


longtoip

# $EPIC: longtoip.txt,v 1.2 2006/08/01 04:07:08 sthalik Exp $

Synopsis:

$longtoip(<integer>)

Technical:

  • If the <integer> value is omitted the empty string is returned.
  • The <integer> value is taken to be a 32 bit unsigned integer.
  • The <integer> value is taken to be in NETWORK ORDER.
  • The return value is the dotted-quad IP address of <integer>

Practical:

This function does the reverse of $iptolong(). The DCC handshake uses 'long's to swap ip addresses. You can use this function to convert the 'long' into a dotted-quad IP address which can then be converted into a hostname by the $convert() function. This can be used to look up the hostname of someone offering you a DCC connection.

Returns:

The dotted-quad IP address equivalent of <integer>

Examples:

$longtoip(2131231747)                                returns "127.8.4.3"
$longtoip(${(127 << 24) + (8 << 16) + (4 << 8) + 3}) returns "127.8.4.3"
longtoip.txt · Last modified: 2006/08/01 04:13 (external edit)