srv_recvpassthru

Description

Receive a protocol packet from a client.

Syntax

CS_RETCODE srv_recvpassthru(spp, recv_bufp, infop)
SRV_PROC         *spp;
CS_BYTE            **recv_bufp;
CS_INT              *infop;

Parameters

spp

A pointer to an internal thread control structure.

recv_bufp

A pointer to a CS_BYTE pointer that will receive the starting address of the buffer containing the received protocol packet.

infop

A pointer to a CS_INT that is set to SRV_I_UNKNOWN if srv_recvpassthru returns CS_FAIL. Table 3-88 describes the possible values returned in *infop if srv_recvpassthru returns CS_SUCCEED:

Table 3-88: CS_SUCCEED values (srv_recvpassthru)

Value

Description

SRV_I_PASSTHRU_MORE

A protocol packet was read successfully and is not the end of message packet.

SRV_I_PASSTHRU_EOM

The packet is the end of message packet.

Returns

Table 3-89: Return values (srv_recvpassthru)

Returns

To indicate

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Examples

Example 1

#include      <ospublic.h>
/*
 ** Local prototype.
 */
CS_RETCODE      ex_srv_recvpassthru PROTOTYPE((
CS_VOID         *spp
));
/*
** EX_SRV_RECVPASSTHRU
**
**   Example routine to receive protocol packets from a client.
**
** Arguments:
**   spp    A pointer to an internal thread control structure.
**
** Returns:
**   CS_SUCCEED If we were able to receive the packets.
**   CS_FAIL If were unsuccessful at receiving the packets.
**
*/
CS_RETCODE    ex_srv_recvpassthru(spp)
SRV_PROC    *spp;
{
     CS_RETCODE    result;
     CS_BYTE       *recvbuf;
     CS_INT        info;

     /*
     ** Read packets until we get the EOM flag.
     */
     do
     {
            result = srv_recvpassthru(spp, &recvbuf, &info);
     }
     while (result == CS_SUCCEED && info == SRV_I_PASSTHRU_MORE);

     return (result);
}

Usage

See also

srv_getloginfo, srv_sendpassthru, srv_setloginfo