Delivering Partial Replies
Your server application may need to deliver multiple reply events to satisfy a request event that it receives. If all of the reply event data cannot be read into memory or is not immediately available, the server may choose to send the reply events in batches rather than all at once.
The awDeliverPartialReplyEvents function can be used in these cases. You must set the flag parameter to AW_REPLY_FLAG_START, AW_REPLY_FLAG_CONTINUE, or AW_REPLY_FLAG_END to indicate the start, continuation, and end of the reply event sequence. If all of the replies can be sent in one batch, simply set the flag to AW_REPLY_FLAG_START_AND_END.
The following example shows the delivery of partial replies:
. . .
flag = AW_REPLY_FLAG_START;
while(!done) {
/* Send the replies */
err = awDeliverPartialReplyEvents(c,e,num,
reply_events,flag,&token);
if (err != AW_NO_ERROR) {
printf("Error on awDeliverPartialReplyEvents\n");
return 0;
}
flag = AW_REPLY_FLAG_CONTINUE;
}
flag = AW_REPLY_FLAG_END;
/* prepare the last event */
. . .
/* Send the last reply */
err = awDeliverPartialReplyEvents(c,e,num,
reply_events,flag,&token);
if (err != AW_NO_ERROR) {
printf("Error on awDeliverPartialReplyEvents\n");
return 0;
}
. . .