PA_ReceiveDataFromServer

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_ReceiveDataFromServer (pluginRef; dataRef; dataKind; data) long

ParameterTypeDescription
pluginReflongID number of plugin's server instance
dataReflongID number of data to be read
dataKindlongType (4-byte OSType) of data to be read
datachar *Requested data
Function resultlongReceived data size in bytes

Description

Provided the 4D plug-in is running a server instance of an plug-in on the server machine, calling PA_ReceiveDataFromServer lets the 4D plug-in request data from the server instance of that plug-in from a client machine .

Before the call:

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

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

After the call, the 4D plug-in obtains the reply to the request in the buffer pointed to by data, and returns its size in bytes.

Example

We receive the picture sent in the example given in PA_SendDataToServer.

   #define   kMY_PLUG_SERVERID   ((long)16789)
   #define   kDATA_PICTUREKIND   'PICT'
   #define   kDATA_TEXTKIND      'TEXT'
   #define   kDATA_BIZARRE      '?¿?¿'

   PA_Handle   thePict;
   long      pictSize;
   char      *ptr;
   pictSize = ReceiveDataFromServer(kMY_PLUG_SERVERID, 0x100, kDATA_PICTUREKIND, 0L);
   if( PA_GetLastError() == eER_NoErr)
   {
      thePict = PA_NewHandle(pictSize);
      if(thePict)
      {
      ptr = PA_LockHandle(thePict);
         pictSize = ReceiveDataFromServer(kMY_PLUG_SERVERID, 0x100, kDATA_PICTUREKIND, ptr);
      PA_UnlockHandle(thePict);
      /* . . . do something with the picture . . .*/
      }
   }

See Also

PA_SendDataToServer.

Error Handling

Use PA_GetLastError to see if an error occurred


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next