PA_SendDataToServer


version 2003


PA_SendDataToServer (pluginRef; dataRef; dataKind; data; dataSize)

Parameter Type Description
pluginRef long ID number of plug-in's server instance
dataRef long ID number of data to be written
dataKind long Type (4-byte OSType) of data to be written
data char * Pointer to data to be written
dataSize long Size of data to be written in bytes

Description

Provided there is a running server instance of a 4D plug-in on the server machine, calling PA_SendDataToServer allows a 4D plug-in, from a client machine, to send data to the server instance of that 4D plug-in package.

Before the call:

• The 4D plug-in passes in pluginRef the ID number of the plug-in's server instance. This number is the resource ID number of the 4BNX resource for this plug-in.

• The 4D plug-in passes the type of data (4 byte OSType) and the data ID number the 4D plug-in is sending in dataKind and dataRef . These values can be whatever is required, using private conventions.

• The 4D plug-in passes in dataSize the size in bytes of the data being sent.

• The 4D plug-in passes in data a pointer to the data to be sent.

NOTE

:

For Macintosh or Windows+Altura users: if data is the master pointer of a handle, you must lock the handle before the call.

If you want to send the data of a PA_Handle , use the pointer returned by PA_LockHandle before the call.

NOTE

:

It is the 4D plug-in's responsibility of the to dispose of the data once the routine completed.

Example

Send a picture parameter to the server. Assuming the plug-in expects that parameter 1 of the routine from within 4D is a picture.

   #define   kMY_PLUG_SERVERID   ((long)16789)
   #define   kDATA_PICTUREKIND   'PICT'
   #define   kDATA_TEXTKIND      'TEXT'
   #define   kDATA_BIZARRE      '?¿?¿'
 
   PA_Handle   h;
   char      *ptr;
   h = PA_GetPictureHandleParameter(params, 1);
   ptr = PA_LockHandle(h);
   PA_SendDataToServer(kMY_PLUG_SERVERID, 0x100, kDATA_PICTUREKIND, ptr, PA_GetHandleSize(h));
   PA_UnlockHandle(h);
   

See Also

PA_ReceiveDataFromServer .

Error Handling

Use PA_GetLastError to see if an error occurred