OpenEdge socket message frame - Forum - OpenEdge Development - Progress Community
 Forum

OpenEdge socket message frame

This question is not answered

Hello,


I am using DOM to build up the XML message (https://knowledgebase.progress.com/articles/Article/P132546) 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.

Brgds,

Olli

All Replies
  • 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?
     
    Brian