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

Hello, My program needs to handshake with another program. The OS is OpenVMS, the other program is the oracle listener, the method of communication is via VMS mailboxes (sort of like unix pipes). I am pretty certain I have the correct content in the several messages my program is sending (I have implemented this on linux and used strace to see what's going on, and on VMS I had some success writing a sniffer to watch how oracle interacted with the listener). However, the listener doesn't accept some of my messages. My only thought is that it's reading them before I'm sending them, or some other synchronization problem. Is there a way I can use select() to guarantee that I send these messages at the correct moment? Thanks for your help Jeremy

Replies are listed 'Best First'.
Re: Timing IPC with "black box" partner
by halley (Prior) on Apr 15, 2004 at 16:52 UTC
    When dealing with interprocess communication, you can only synchronize your actions based on the observed actions of the involved processes. Watch for a file being created. Watch for a system semaphore. Respond to a system event. Respond to an input command. Wait for a lock to be unlocked. Observe concrete signs that the other process is certainly past a specific state milestone.

    You are asking for trouble if you assume that you can watch the clock on the wall (e.g., using alarms, timeouts or sleeps) to decide when the other process "must be ready by now."

    --
    [ e d @ h a l l e y . c c ]