print $data while read($socket, $data, 1024) > 0;