my $nonblocking = 1; ioctl($sock, 0x8004667e, $nonblocking) or die "ioctl socket: $!\n"; my $sockread = sysread($sock, $buffer, $chunk); #should be non-blocking $nonblocking = 0; ioctl($sock, 0x8004667e, $nonblocking) or die "ioctl socket: $!\n"; $sockread = sysread($sock, $buffer, $chunk); #should block