PA_ReceiveDocumentFromServer

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

version 2003


PA_ReceiveDocumentFromServer (docName; data) long

ParameterTypeDescription
docNamechar *Name of the received file
datachar *Pointer to the document data
Function resultlongReceived data size in bytes

Description

While running under 4D Client, the routine PA_ReceiveDocumentFromServer lets the 4D Plug-in read a document located on the server machine.

Pass the name of the document to read on the server side in docName . The 4D plug-in MUST pass the short name of the document NOT the pathname to the document. The document must be located in the same folder/directory than the structure.

Pass a pointer to a buffer that will be filled with the data fork of the document in data.

The routine returns the size of received data in bytes.

NOTE:

This routine is available only with 4D Client. To detect if the 4D plug-in is running on 4D Client, use PA_Is4DClient

Depending on default settings or on previous calls to PA_UsePStrings or PA_UseCStrings, docName must be a Pascal or an ANSI C string.

After the call a pointer to a memory block holding the document contents is returned in data.

You first call the routine setting data to 0L to get the size of the needed buffer. Then you allocate this buffer and call the routine again.

IMPORTANT NOTE:

PA_ReceiveDocumentFromServer or PA_SendDocumentToServer deal only with the data fork of a document when used on a Macintosh platform.

NOTE:

Documents stored on a server machine and accessed using PA_ReceiveDocumentFromServer or PA_SendDocumentToServer are sent over the network and must fit into the memory of the workstation. It is therefore a good idea to refrain from using these entry points in small or medium size documents.

Example

Read the document "PrivatePrefs" on the server side

   char   *theDoc;
   long   size;

   size = PA_ReceiveDocumentFromServer("\pPrivatePrefs", 0L); // Use Pascal string under MacOS
   if(PA_GetLastErro() == eER_NoEr)
   {
      theDoc = malloc(size);
      if(theDoc)
      {
         PA_ReceiveDocumentFromServer("\pPrivatePrefs", theDoc);
         /* . . . deal with theDoc . . . */
      // cleanup
         free(theDoc);
      }
   }

See Also

PA_SendDocumentToServer.

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