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

For starters, fork creates a thread (not a process) in Windows. Is that a problem?

I wrote a script to communicate b/w processes bidirectionally using pipes ,but it doesn't work as intended

The script you posted runs on neither linux nor Windows until you fix the issue with reading until a newline is encountered when none is sent. Then, it works fine on both linux and Windows.

Since I need to run the same script in windows,I think I can't use socketpair like below for bidirectional communication rt?

I'm pretty sure you can, but you might have to change from AF_UNIX to AF_INET.

Replies are listed 'Best First'.
Re^2: Message Passing b/w processes , that works both in windows and Linux
by shijumic (Novice) on Jun 08, 2009 at 22:45 UTC
    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

        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.

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