You are here: SwitchKit® Development Environment Programmer’s Guide > 2 Connection Management > Applications Connecting to One LLC

Applications Connecting to One LLC

Description

If you are working in an environment with only one LLC and if you are not going to change to an environment with multiple LLCs, you can use this model.

How to use the Simplified Connection Model

To connect to just one LLC in the system, your application can call sk_initializeConnection() or sk_initializeForcedConnection(). These function calls initialize a socket to the LLC with a number named connectionName.

Calling these functions does not open the socket. The socket must be opened by sending a message with the specific connectionName to the LLC.

How initializeConnection works

If your application calls sk_initializeConnection(), any previous connection to the LLC is terminated, and a new one is initialized with the specified connection name.

If a requested connection name is already in use, the first available integer greater than connectionName is assigned automatically to the application. To ensure that your application receives an unused connection name, call the function with an argument of -1.

How initializeForcedConnection works

The function sk_initializeForcedConnection() behaves exactly as sk_intializeConnection() does, except when connectionName is already in use by another application to the LLC. Instead of receiving a new, unused connection name, your application insisting on the specified name causes the first connection to terminate.

Functions in this Model

int sk_initializeConnection();

int sk_initializeForcedConnection();

int sk_closeConnection();

int sk_getLLCSocketDescriptor();

int sk_getConnectionName();