OpenEdge socket message frame

Posted by olli havilehto on 28-Dec-2017 09:21


I am using DOM to build up the XML message ( and sending it as a MEMPTR via socket to the endpoint. The endpoint API documentation states:

"4 Message Data

  • All messages are framed by 4 bytes header which indicates the length of payload. The payload is in XML format. 

4.1 Message Frame

  • 4 bytes length, big-endian byte order."

Which means I need to measure the size of the payload part of the message and attach the length into the socket request as a "frame".

I've tried to go through the OpenEdge documentation but have had no luck considering  message framing. Any help would be held in high regard.



All Replies

Posted by Brian K. Maher on 29-Dec-2017 08:08

Hi Olli,
I think that all they mean by “frame” is that you need to end up with a memptr that contains 4 bytes (holding the length, use a PUT-LONG for this) followed by the data.
For example, “0017this is some data” (but where the 0017 would actually be encoded into a LONG using PUT-LONG so you are not limited to 9,999 bytes of data.
You could use two memptr variables, one to hold the data only (to get the size) then the second one would have its size set to get-size(memptr1) + 4 then finally copy the data from memptr1 to memptr2 starting at position 5.
Does that make sense?

This thread is closed