Receive a protocol packet from a client.
CS_RETCODE srv_recvpassthru(spp, recv_bufp, infop)
SRV_PROC *spp; CS_BYTE **recv_bufp; CS_INT *infop;
A pointer to an internal thread control structure.
A pointer to a CS_BYTE pointer that will receive the starting address of the buffer containing the received protocol packet.
A pointer to a CS_INT that is set to SRV_I_UNKNOWN if srv_recvpassthru returns CS_FAIL. The following table describes the possible values returned in *infop if srv_recvpassthru returns CS_SUCCEED:
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 |
To indicate |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed. |
#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);
}
srv_recvpassthru receives a protocol packet without interpreting its contents.
Once srv_recvpassthru is called, the event handler that called it is in “passthrough” mode. Passthrough mode ends when SRV_I_PASSTHRU_EOM is returned in *infop.
No other Server-Library routines can be called while the event handler is in passthrough mode.
In passthrough mode, the SRV_CONNECT handler for the client must allow the client and remote server to negotiate the protocol packet format by calling srv_getloginfo, ct_setloginfo, ct_getloginfo, and srv_setloginfo. This allows clients and remote servers running on dissimilar platforms to perform any necessary data conversions.
srv_recvpassthru can be called in all event handlers except SRV_START, SRV_CONNECT, SRV_STOP, SRV_DISCONNECT, SRV_URGDISCONNECT, and SRV_ATTENTION.
Once it has called srv_recvpassthru, an application cannot call any other routine that does I/O until it has issued a srv_senddone.