srv_setuserdata

Saves a pointer to private data space in an SRV_PROC structure.

Syntax

int srv_setuserdata (
SRV_PROC *
srvproc,
void *
ptr );

where

srvproc
Is a pointer to the SRV_PROC structure that is the handle for a particular client connection. The structure contains the information that the ODS Library uses to manage communication and data between the Open Data Services server application and the client.
ptr
Is a pointer to the private data space for Open Data Services processes.

Returns

SUCCEED or FAIL.

Remarks

The ODS Library passes the current SRV_PROC structure to most event handlers. A pointer to user data can be saved in the SRV_PROC structure by using srv_setuserdata. This pointer to user data allows Open Data Services server applications to access private data without using global or static variables to hold private data. Open Data Services programs can then be reentrant.

The ptr pointer is not manipulated in any way by the ODS Library. It is provided only for the convenience of Open Data Services developers. The data that ptr points to can be allocated at connect time and accessed later with srv_getuserdata.

See Also

This entry For information about
srv_getuserdata Getting a pointer to private data space in a server process