Possible return values for this function:
SK_LOST_LLC |
This return value indicates that your application lost contact with the LLC. |
SK_NO_ |
No message was received. The time-out expired before any messages (other then Poll messages) were received by the LLC. |
SK_BAD_ |
An improperly formatted message was received. |
SK_NOT_ |
Message was not handled by handler function, no results available. |
Example
Code sample demonstrating the use of sk_rcvAndDispatch().
#define MSG_SIZE=1024
main(int argc, char *argv[])
{
char buf[MSG_SIZE];
int sz, ret;
void *dta;
char * AppName;
SKC_Message * msg;
...
/*Initialize connection to LLC with name*/
sk_initializeConnection(TANDEM_APP);
...
while (1) {
sz = MSG_SIZE;
/*Initialize maximum size of message to receive*/
if (debug > 5)
printf("\nWaiting for an Inseize at %s for 600 secs...\n", argv[1]);
/* Wait up to 600 seconds for a message. If a message is received that has handler function(s), rcvAndDispatch will automatically call the handler function(s) and return the result of the last handler function called. If there are no handler functions, then SK_NOT_HANDLED is returned, and we just print some info about the message.*/
ret = sk_rcvAndDispatch(buf, &sz, 600, &dta);
....
} /* (ret == SK_NOT_HANDLED) */
...
} /* while (1) */
} /* main */