You are here: SwitchKit® Development Environment Programmer’s Guide > 7 Message Functions > sk_sendMessageWithHandler()
Description
The sk_sendMessageWithHander() function takes the results of sk_packMessage() and sends a character buffer indicating the size to the switch. If no appropriate message structure is available to pass to sk_packMessage(), the character buffer can be filled in manually.
This function takes a void pointer called tag as an argument. It can be an arbitrary value and is not used or change by SwitchKit. Upon receipt of an acknowledgment, the value is passed to the HandlerFunc to provide some context associated with the sent message.
The sk_sendMessageWithHandler() function also takes a pointer to HandlerFunc as an argument. The function HandlerFunc points to is called to handle the receipt of any acknowledgment, when or if it arrives.
This message is also available as sk_sendMessageWithHandlerOnConnection().
int sk_sendMessageWithHandler(char *aBuffer, aBufSize,
void *aTag, HandlerFunc *);
int sk_sendMessageWithHandlerOnConnection(char *aBuffer,
int sz, void *aTag, HandlerFunc *aHandlerFunc, int aConID);
The function parameters are shown in the table below.
Argument |
Description |
---|---|
aBuffer |
Pointer to a packed message. |
aBufSize |
Size of the packed message. |
aTag |
An application defined pointer which will be returned to the application when a handler is invoked. |
aHandlerFunc |
A pointer to a function that is designed to handle messages. |
aConID |
aConID is a connection identifier specified at connection creation time and used to indicate which LLC an application wishes to communicate with. |
Possible return values for this function:
SK_LOST_LLC |
This return value indicates that your application lost contact with the LLC. |
SK_UNKNOWN_MSG_ |
Buffer and Size pointers do not point to a valid message. |
SK_NO_CONNECT_ |
The specified connection from OnConnection() is not available or valid. |