Passing binary data

You can pass binary data, such as JPEG files, when using a Java or .NET client. On the client side, the binary data is handled as an ArrayList for a Java client and as a byte array for a .NET client.

If you are attributing your code, set the type property of the xfParameter attribute to SynType.binaryhandle. (Or, in the MDU, define the parameter as a “Binary (handle)” data type.) Your Synergy server routine must declare the argument that receives the data as a memory handle (i4; do not use int). xfServerPlus will place the data in a memory area and pass the memory handle allocated to that area to your Synergy server routine. (You must use the memory handle provided by xfServerPlus; do not attempt to allocate your own.) After the data has been returned to xfNetLink, xfServerPlus will free the memory area.

Note

If you are using a .NET client, binary fields in structures are converted to byte arrays by default. However, you should use the procedure described above to pass binary data such as JPEG files rather than a binary field in a structure, because the latter requires that you specify a size. See also the description of the gencs -nb option in Generating C# classes with gencs.

For details on passing binary data, including code samples, refer to the topic for your client:

If you have defined a binary (handle) parameter in the SMC for use with a Java or .NET client, and you want to also use an xfNetLink Synergy client with your server-side code, write your Synergy client code as though you were passing variable length data. That is, create a memory area on the client and pass the memory handle (as the parameter that is defined as a binary (handle)) to xfServerPlus using the RCB_xxx routines. (See Passing a single parameter as a memory handle.) Do not alter the method definition in the SMC. When xfServerPlus receives the call from the Synergy client, it will not give a “parameter mismatch” error because it has been programmed to permit a mismatch when a Synergy client passes a memory handle to a parameter that is defined as a binary (handle) parameter in the SMC.