my $rx_txt = "something"; while (length($rx_txt) > 0) { $conn->recv($rx_txt, 1024); $buff.=$rx_txt; }