in reply to Problem with IO::Select

my $rx_txt; while (length($rx_txt)) { $sock->recv($rx_txt, 1024); $buff.=$rx_txt; }
Last time I checked, the length of undef is 0 (while getting a warning), and that's false. Can't imagine the code inside that loop makes much difference then. :)

Replies are listed 'Best First'.
Re^2: Problem with IO::Select
by timos (Beadle) on Mar 01, 2007 at 00:11 UTC
    You are right of course. But this does not fix my problem. The results are the same with
    while (length($rx_txt) > 0) { $sock->recv($rx_txt, 1024); $buff.=$rx_txt; }
    But I have to admit I am a little bit ashamed of myself now. :-)
      You still aren't reading anything. length(undef) is certainly not greater than 0.

      Also, $sock is not the right socket to be reading from anyway.

        Ah, ok. So I changed it to
        my $rx_txt = "something"; while (length($rx_txt) > 0) { $conn->recv($rx_txt, 1024); $buff.=$rx_txt; }
        But the problem stays the same.