Postmessage not working between two different processes

Author: knut.dybendahl@gmail.com (Knut)

Hi all, I came across this issue this week. The documentation had me heading down the wrong track for a few hours (cut from the documentation): "The postmessage statement sends a message to the specified component instance. It is typically used for asynchronous communication between component instances running in the same or in a different process. For example, it can be used for communication between master and detail component instances, or to a remote service." Key words for me here were "different process" and "remote service". Nope. Couldn't get it to work at all.... Until I found a youtube video from Eddy Knochs (thanks Eddy!) (http://youtu.be/dvFfQ6rIH_A) Who knew you need a 3gl signature defined... See 10mins in on video. Hey presto - it works. Even RT(F)M seems to be a bit short these days - we need to WT(F)V!! Laugh

4 Comments

  1. Umm, on windows we do this between the server and (multiple) client machines using postmessage directly, with no need for activate, or signatures. Is this because we're using urouter?  The address in postmessage to communicate is "%%$instancepath%%%:%%$instancename%%%" as recorded from the target (info shared using a database).  We do have to use the /ust switch on the command line to register a unique id with the urouter, is that perhaps the magic bullet?  Or am I misunderstanding what you are doing?  Iain


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  2. It is not true that the 4GL postmessage command is restricted to instances within the same Uniface runtime. That was so in Uniface 7, but since Uniface 8 you can postmessage to any process (even on another machine and OS) that has registered with an urouter. You definitely do not need the UpostMessage DLL to do that. As a matter of fact, there's precious little difference between the 4GL and 3GL postmessage versions, they execute the same code internally.  - Chris


    Author: Chris Breemer (chris.breemer@uniface.com)
  3. Hi Knut, Chris is correct. I'm now trying to stretch my memory back to when I did the video. I spent a bit of time experimenting with a lot of aspects of postmessage, which I managed to cram into that video.  Defining a C signature for the DLL was just one challenge that I wanted to try out.  It might be useful for sending messages between Uniface 8 and 9 applications (untested). Also, at the time of the video, the Uniface Library was incomplete, perhaps incorrect, about what we actually supported.  I think this all lead to a rewrite of the documentation at 9.6.02 Eddy.


    Author: Eddy Knochs (eknochs@ozemail.com.au)
  4. Eddy Knochs said Defining a C signature for the DLL was just one challenge that I wanted to try out.  It might be useful for sending messages between Uniface 8 and 9 applications (untested).

    If that does not work with 4GL postmessage, it won't work with the DLL either (remember that they share the same code). And in fact it does not work, you get a handshaking error saying that the polyserver protocol is incompatible. There is really no need to consider the DLL unless you want to post messages from a non-Uniface application.   -- Chris


    Author: Chris Breemer (chris.breemer@uniface.com)