http://www.perlmonks.org?node_id=281238


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.

Flame ~ Lead Programmer: GMS (DOWN) | GMS (DOWN)