# Now wait for packets to send
# and then send them down the line
# a packet of 'undef' is the signal to close the connection
while ( defined( $packet = $packetqueue->dequeue ) )
{
# ... Prepend header to data packet
$buf = $header . $packet;
# Send it out
$client->syswrite($buf);
}