You are here: SwitchKit® Development Environment Programmer’s Guide > 4 Register Functions > sk_appGroupRegister()

sk_appGroupRegister()

Description

The sk_appGroupRegister() function allows a process register to receive messages directed to the specified application group. This application group is a text name. The application group name can be used in both InterAppMsg and TransferChanMsg. Whenever a message is sent to an application group, the LLC routes that message to the least loaded application (as specified through sk_broadcastLoad()) that has registered for that application group. This function can be used to allow client applications to refer to servers by a text name instead of by a number. Furthermore, there can be multiple servers set up to load share application requests.

For example, you could build a database server that receives SwitchKit messages, does database queries, and replies. Instead of defining a single application number of the database server, you can instead use the string "databaseServer" in all InterAppMsg database requests. Whenever you run a database server, it registers for that application group and is available to receive database requests. If it is feasible to run multiple database servers, the requests are load shared among the available servers.

This message is also available as sk_appGroupRegisterOnConnection() and skts_appGroupRegister().

Syntax

int sk_appGroupRegister(const char *virtualName);

int sk_appGroupRegisterOnConnection(const char *virtualName, int conID);

Threadsafe Syntax

int skts_appGroupRegister( const char * aVirtualName, int aConID);

Parameters

The function parameters are shown in the table below.

Argument | Description
--- | ---
aVirturalName | A string identifier for an application group which can be targets for an InterAppMsg or TransChanMsg.
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.

Useful Related Functions

SK_Connection *sk_createConnectionWithID();