IPC Communication

I want the on-demand script to wait a reasonable amount of time (like 60 seconds), and  then give up and tell the user.

Have inherited this code.  Script1 (on demand)  invokes Script2 via batch, waits for it to finish, and tells the user the results.  The Script2 tells the Script1 when it is finished and sends a status string.

Script1 invokes the batch via eval_, then calls the following:

void waitForExec() {
    string msg = "xx"
    IPC srvr = server(7742)
//    if (accept(srvr)) {
        if (recv(srvr, msg, 1)) {                           
            disconnect(srvr)
            delete(srvr)
            if (msg == "OK") {
                warningBox("From Original  " msg "  Proposed Change's have been applied.")               
            } else {
                warningBox("From Original  " msg)
            }
        } else {
            disconnect(srvr)
            delete(srvr)
            warningBox("Unable to tell if your submission was successful.\nLost the implementor.")
        }
//    }
} // waitForExec
    // Louie commented out the "accept" command to no avail

Script2 does this at its end:

hostReply = "Results of Script"
clnt = client(7742, hostname) // Attach to the input script
send(clnt, hostReply) // Send back status
disconnect(clnt)
delete(clnt)

I cannot make Script1 give up, it hangs indefinately until Script2 actually finishes.

I would have thought the "recv" command, waiting "1" second, should do it.

What is this doing wrong?


llandale - Wed Feb 11 14:51:38 EST 2015

Re: IPC Communication
Mathias Mamsch - Fri Feb 13 02:58:38 EST 2015

Hmm ... I used a similar code which used to work fine. Cannot spot anything right away. Will try later.

Why are you using IPC though? Do the two scripts run on different computers? It seems to me that checking for the existing of a predefined temp file is much more stable, if the processes run on the same computer.

I know that blocking has always been a problem with DOORS IPC. You need to be very careful to only call "recv" when you know that data will come in. I tried to use the nonblocking variants with no success. Also only call accept when you know that you will receive a connection. The DXL will be blocked otherwise.

Regards, Mathias