Interprocess / Skript to Skript

Discussion in 'Perl Misc' started by clqrq@yahoo.de, Jan 9, 2006.

  1. Guest

    Hi there, i'm a little bit stuck with my programm and need help, so
    let me reduce it to the problem...

    I have two skripts; the first does the following:
    It saves the Process-ID ($$) to a file and enters a loop, waiting for
    Strings.

    The second shall read the PID from file and till here, everything is
    fine. Now, skript #2 shall send a string (lets say $test='Hallo';) to
    Skript #1 and wait for reply. What I dont understand is:

    How can Skript #2 send a string to Skript #1?
    How can Skript #1 get the String.

    - - -
    #!/usr/bin/perl

    #####################################
    The First Skript
    #####################################

    if (open(BS,'>','../server.pid')) {
    print BS $$;
    close BS;
    }

    #
    # here we need a loop, checking for incoming messages
    # and processing strings, then returning them to sender
    # - one special message shall break the loop
    #

    exit;

    - - - -

    #!/usr/bin/perl

    #####################################
    The Second Skript
    #####################################

    $test='hallo';

    if (open(BS,'<','../server.pid')) {
    $Server-PID=<BS>;
    close BS;
    }

    print &CallServer($Server-PID,$test);

    exit;

    sub CallServer {
    my $answer=''; # the answer of the server
    my $SPID=$_[0]; # servers PID
    my $Message=$_[1]; # Message to send

    #
    # here we need a way to send $$ and one or
    # more strings to $Server-PID, waiting for response
    #
    return $answer;
    }
     
    , Jan 9, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Swapnajit Mittra
    Replies:
    0
    Views:
    468
    Swapnajit Mittra
    Dec 21, 2004
  2. Dave Bartlett

    newbie question: interprocess communication

    Dave Bartlett, May 13, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    520
    DalePres
    May 13, 2004
  3. schwerdy
    Replies:
    2
    Views:
    356
    schwerdy
    Oct 27, 2003
  4. Guest

    Skript problem / display in 3 rows

    Guest, Jul 27, 2003, in forum: ASP General
    Replies:
    1
    Views:
    130
    Bullschmidt
    Jul 30, 2003
  5. Replies:
    1
    Views:
    92
    Anno Siegel
    Feb 21, 2006
Loading...

Share This Page