In the Event Tutorial (maybe POD doc) there was mention
of the blocking problem, recommendation was IPC::LDT or similar. Use messages that include the total length at the beginning of the message.
read SOCK, $len_raw, 4;
$len = unpack 'N', $len_raw;
read SOCK, $msg, $len;
and
$len = length $msg;
$len_raw = pack 'N', $len;
write SOCK, $len_raw, 4;
write SOCK, $msg, $len;
or
write SOCK, "$len_raw$msg", $len+4;
Something like that should handle the simple cases. |