You are here: SwitchKit® Development Environment Programmer’s Guide > 3 Channel Management > sk_requestChannel()

sk_requestChannel()

Description

To find an unused channel in the group, your application must call sk_requestChannel(). If successful, the application receives notification of the channel it was assigned. The channel can receive inbound calls, the application must be prepared to handle an inseizure before the channel can be used. Inseizure is indicated by the receipt of a RequestForService or RFSWithData message.

This function causes SK_RequestChannelAck, an acknowledgment message, to be sent to your application after processing has been completed. This message contains the span and channel allocated to the application module. This channel is now allocated to the application module, and all future messages for that channel are routed to this process.

The aTag and aHandlerFunc are equivalent to the tag and handler function arguments passed to sk_sendMsgStruct().

Important! To request a channel using the threadsafe library, use skts_requestOutseizedChannel().

This function is also available as sk_requestChannelOnConnection().

Syntax

int sk_requestChannel(char *aChannelGroup, void *aTag, HandlerFunc *aHandlerFunc);

int sk_requestChannelOnConnection(char *aChannelGroup, void *aTag, HandlerFunc *aHandlerFunc, int aConID);

Parameters

The function parameters are shown in the table below.

Argument | Description
--- | ---
aChannelGroup | *group specifies the channel group.
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.

Return Values

Possible return values for this function:

SK_LOST_LLC | This return value indicates that your application lost contact with the LLC.
SK_NO_CHANNELS | There are no channels available.