srv_sendpassthru

Description

Send a protocol packet to a client.

Syntax

CS_RETCODE srv_sendpassthru(spp, send_bufp, infop)
SRV_PROC      *spp;
CS_BYTE         *send_bufp;
CS_INT           *infop;

Parameters

spp

A pointer to an internal thread control structure.

send_bufp

A pointer to a buffer that contains the protocol packet.

infop

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

Table 3-122:  CS_SUCCEED values (srv_sendpassthru)

Value

Description

SRV_I_PASSTHRU_MORE

The protocol packet was sent successfully and it is not the end of message packet.

SRV_I_PASSTHRU_EOM

The end of message protocol packet was sent successfully.

Returns

Table 3-123:  Return values (srv_sendpassthru)

Returns

To indicate

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Examples

Example 1

#include    <stdio.h>
#include    <ospublic.h>

/*
** Local Prototype.
*/
CS_RETCODE      ex_srv_sendpassthru PROTOTYPE((
SRV_PROC        *spp
));

/* 
** EX_SRV_SENDPASSTHRU
**
**  Example routine to send a protocol packet to a client.
**
** Arguments:
**  spp  A pointer to an internal thread control structure.
**
** Returns:
**
**  CS_SUCCEED 
**  CS_FAIL
*/
CS_RETCODE      ex_srv_sendpassthru(spp)
SRV_PROC        *spp;
{
      CS_BYTE    sendbuf[20];
      CS_INT     info;

      strcpy(sendbuf, “Here’s what to send”);

      if (srv_sendpassthru(spp, sendbuf, &info) == CS_FAIL)
      {
            return(CS_FAIL);
      }
      else
      {
            if (info == SRV_I_PASSTHRU_MORE)
            {
                printf(“more to come...\n”);
                return(CS_SUCCEED);
            }
            else if (info == SRV_I_PASSTHRU_EOM)
            {
                printf(“That’s all.\n”);
                return(CS_SUCCEED);
            }
            else
            {
                printf(“Unknown flag returned.\n”);
                return(CS_FAIL);
            }
      }
}

Usage

See also

srv_getloginfo, srv_recvpassthru, srv_setloginfo