Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Communication between two processes

by SmilingBuddha (Acolyte)
on Jan 04, 2005 at 09:45 UTC ( #419191=perlquestion: print w/replies, xml ) Need Help??

SmilingBuddha has asked for the wisdom of the Perl Monks concerning the following question:

Dear wise monks,

I have a unix shell which will launch an interacive tool (with its own interactive shell/prompt) and another unix shell which will launch a Tcl shell (prompt). This means that there are 2 processes running on 2 unix shells.
What I want is that there should be a socket communication between these 2 processes, with the Tcl shell as the master of the two. Any command on the Tcl shell will be checked for error and then executed either on its own shell or on the other (tool) shell over the socket link.
Can you please provide me pointers as to how I can achieve the above (if possible, optimally)?
---
Do unto others as you would expect others to do unto you - The Golden rule of Life!

Replies are listed 'Best First'.
Re: Communication between two processes
by Anonymous Monk on Jan 04, 2005 at 09:48 UTC
    You could start with 'man perlipc', 'man Socket' and 'man IO::Socket'.
Re: Communication between two processes
by tbone1 (Monsignor) on Jan 04, 2005 at 12:37 UTC
    This seems like more of a question about Unix shells than Perl. Still, I'm enough of a Unix geek to enjoy these sorts of problems. What is it, exactly, that you wish to do? This sounds eerily like a really warped project I had years ago that required coprocesses. However, I really hate recommending that. Maybe you'd be better off having the shell/tool be a child process, which listens for commands from the Tcl process.

    Just a thought.

    --
    tbone1, YAPS (Yet Another Perl Schlub)
    And remember, if he succeeds, so what.
    - Chick McGee

      This indeed is more on unix but will be impemented in perl. To make the problem simple:
      Let us assume we have two perl scripts running (and in some kind of wait mode). These perl scripts are independednt and do not have any knowledge of each other. Perl script 1 should now establish a communication with perl script 2 to which perl script 2 will do some task and return something to perl script 1.
      I will extend the same logic to unix shells later. The question here is... how to make the above possible?
      ---
      Do unto others as you would expect others to do unto you - The Golden rule of Life!
Re: Communication between two processes
by aquarium (Curate) on Jan 04, 2005 at 10:12 UTC
    try using expect from shell or expect.pm from perl.
    the hardest line to type correctly is: stty erase ^H

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://419191]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-07-01 10:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (98 votes). Check out past polls.

    Notices?