On 8/29/07, JT Moree <[EMAIL PROTECTED]> wrote: > Given that we are still disagreeing on what is the best way to do it; > Can we use all information used so far to get the most unique possible > for now? Even if it's not perfect, it's a start. Even if some of the > information seems extraneous to some people (and may be) it's still > better than nothing. > > Short of using UUID i'd say doing something like this. I've tried to > put the order of information from most static to most dynamic. > > Using HiRes::Time > > my $ip = $conn->remote_ip($ip); > my $rport = $conn->remote_port || "0"; > my $lport = $conn->local_port || "0"; > my $start = time; > my $id = "$$_$start.$lport_$ip:$rport"; > > -- > JT Moree >
if you want to be paranoid, you have to have all 4 data points from the connection- local port/ip, and remote port/ip, plus local boxes' time with high granularity. if you re-gen '$start' with each transaction within the connection, you dont need a per-connection counter, provided that your time is fine enough to prevent collisions. If you leave out any of the local info, an installation with two servers with un-synced times could still gen the same id. if you add it, then the only way you could have a collision is if your time is not granular enough or gets set back. tcp sequence numbers can also be useful here as a replacement for time, but might be hard to get within perl? allan -- "The truth is an offense, but not a sin"