> > my $lip = $conn->local_ip();
>     up to 15 characters (39 with IPv6)
> > my $rip = $conn->remote_ip();
>     up to 15 characters (39 with IPv6)
> > my $rport = $conn->remote_port || "0";
>     up to 5 characters
> > my $lport = $conn->local_port || "0";
>     up to 5 characters
> > my $start = time;
>     up to 16 characters
> $$
>     up to 5 characters (10 for 32bit PIDs)
> > my $id = "$$_$start_$lip:$lport_$rip:$rport";
>     5 + 1 + 16 + 1 + 15 + 1 + 5 + 1 + 15 + 1 + 5 = 66 characters
> or even
>     10 + 1 + 16 + 1 + 39 + 1 + 5 + 1 + 39 + 1 + 5 = 119 characters

Better encode it binary. E.g. for IPv4:

my $id = pack("NCNNNN",$$,$start,$lip,$lport,$rip,$rport)

Sum: 21 Bytes. Encoded in Base64: 28 Bytes.


Regards
Michael

-- 
It's an insane world, but i'm proud to be a part of it. -- Bill Hicks

Reply via email to