in reply to Re: Message Passing b/w processes , that works both in windows and Linux
in thread Message Passing b/w processes , that works both in windows and Linux

Thanks much for your rely. Would you please explain me,how to fix the issue with reading until a newline is encountered when none is sent in the above script.
Thanks
-Shijumic
  • Comment on Re^2: Message Passing b/w processes , that works both in windows and Linux

Replies are listed 'Best First'.
Re^3: Message Passing b/w processes , that works both in windows and Linux (read)
by tye (Sage) on Jun 09, 2009 at 00:25 UTC

      Switching to read alone won't be sufficient (in the child). There would be no way of knowing whether the message has been fully received.

        Given the sample code, actually that particular problem wouldn't apply either in the case of pipes or sockets. I'm not sure whether the code is actually complete, but it looks like the messages being passed are quite short, which means that they won't ever be fragmented. I guess you could still have a problem with getting two messages at once, though.

        Likewise, using "\n" as your message terminator won't work if your messages might contain "\n"s (I wasn't convinced such was impossible based on the offered code). But it seems at least a good starting point.

        - tye        

Re^3: Message Passing b/w processes , that works both in windows and Linux
by ikegami (Patriarch) on Jun 09, 2009 at 00:10 UTC

    Since the readers are waiting for a newline, I sent one by changing
    print $handle $message;
    to
    print $handle "$message\n";