in reply to Re^3: Message Passing b/w processes , that works both in windows and Linux (read)
in thread Message Passing b/w processes , that works both in windows and Linux

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.

  • Comment on Re^4: Message Passing b/w processes , that works both in windows and Linux (read)
  • Download Code

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

    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