in reply to Detecting a closed socket
Ok, I think I've got my solution then:
unless(sysread($handle,$count,4) == 4 && $count =~ m/^\d{4}$/ && + sysread($handle,$message,$count) == $count){ # print "Error/Disconnect\n"; return; }
I've tested it and it seems to work. Thanks to everyone for the input.
My code doesn't have bugs, it just develops random features.
In Section
Seekers of Perl Wisdom