Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Sockets : Read, writing, and managing sockets on clients and servers : Marshalling and unmarshalling data for socket I/O
 
Marshalling and unmarshalling data for socket I/O
After reading data from a socket into a MEMPTR variable, any ABL procedure that needs to interpret the data must unmarshall the data from the MEMPTR memory region. Unmarshalling the data converts it from bytes in memory to the ABL data types that the ABL procedure can use, as determined by your application and the byte order of the MEMPTR data.
Similarly, before writing data to a socket from a MEMPTR variable, an ABL procedure must marshall data into the MEMPTR memory region. Marshalling the data converts it from the ABL data types the procedure understands to bytes in memory that can be written to the socket. Again, how you organize the bytes in the MEMPTR memory region depends on your application and the application with which you are communicating.
ABL supports several statements and functions for marshalling and unmarshalling data in different forms. All such statements and functions that interact directly with MEMPTR variables convert between bytes and ABL data types according to the MEMPTR byte order that you specify. Before using a MEMPTR variable to read or write socket data, both the socket client and socket server must set their respective MEMPTR variables to an identical byte order. When marshalling and unmarshalling the data, you must make certain to access MEMPTR data in conformance with the agreed and specified MEMPTR byte order.
For more information on byte order and the statements and functions for marshalling and unmarshalling MEMPTR data, see Introduction to External Program Interfaces.