Send a protocol packet to a client.
CS_RETCODE srv_sendpassthru(spp, send_bufp, infop)
SRV_PROC *spp; CS_BYTE *send_bufp; CS_INT *infop;
A pointer to an internal thread control structure.
A pointer to a buffer that contains the protocol packet.
A pointer to a CS_INT that is set to SRV_I_UNKNOWN if srv_sendpassthru returns CS_FAIL. The following table describes the possible values returned in *infop if the routine returns CS_SUCCEED:
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 |
To indicate |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed. |
#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);
}
}
}
srv_sendpassthru sends a protocol packet received from a client program or Adaptive Server without interpreting its contents.
srv_sendpassthru performs byte ordering on protocol header fields.
Once called, the thread that called it is in passthrough mode. Passthrough mode ends when the SRV_PASSTHRU_EOM is returned.
No other Server-Library routines can be called while the event handler is in passthrough mode.
To use passthrough mode, the SRV_CONNECT handler for the client must allow the client and remote server to negotiate the protocol 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_sendpassthru can be used in all event handlers except SRV_CONNECT, SRV_DISCONNECT, SRV_START, SRV_STOP, SRV_URGDISCONNECT, and SRV_ATTENTION.