in reply to Re^3: Using read/syswrite with IO::Socket::SSL
in thread Using read/syswrite with IO::Socket::SSL

O.k., can_read() takes a timeout value as an argument and if that it set to 0, it will not block. I understand.

According to the docs it returns a list of handles that are ready for reading.

Is it correct that I have to traverse this list and check whether $sock is amongst them to fulfil the condition You stated?

  • Comment on Re^4: Using read/syswrite with IO::Socket::SSL

Replies are listed 'Best First'.
Re^5: Using read/syswrite with IO::Socket::SSL
by tybalt89 (Monsignor) on Oct 26, 2016 at 17:52 UTC

    ->can_read(0) will only return handles that have been set into the IO::Select object. Only set those you are interested in.

    BTW, from the fragment you gave, $sock is your listen socket and is only used for accepts. $client_sock is your read/write socket.

    typical code fragment:

    for my $handle ( $sel->can_read(0) ) { if( $handle == $sock ) { # do accepts here... } elsif( $handle == $client_sock ) { # do sysreads here... } }