You are here: SwitchKit® Development Environment Programmer’s Guide > 2 Connection Management > sk_initializeConnection() / sk_initializeForcedConnection()

sk_initializeConnection() / sk_initializeForcedConnection()

Description

Use a function call to sk_initializeConnection() or sk_initializedForcedConnection() function to establish a socket between your application and the LLC. The connection will be established with the IP and port numbers specified in the environment variables SK_LLC_HOST/PORT and SK_RLLC_HOST/PORT.

Syntax

int sk_initializeConnection(int anAppID);

int sk_initializeForcedConnection(int anAppID);

Parameters

The function parameters are shown in the table below.

Argument | Description
--- | ---
anAppID | anAppID is the application identifier used by the LLC to route messages to the application and to log any events of interest regarding the application. If the caller of the function does not care which application identifier it receives, it can specify -1. This allows LLC to select the next available application identifier beginning at 10. If the specified application identifier is already used, the LLC will assign the next available identifier beginning at the requested identifier, unless the isForcedFlag is set to 1 or sk_initializeConnectionForced() was used to establish the connection with LLC.

Return Values

Possible return values for this function:

SK_CONNECT_IN_USE | This return value indicates that the specified connection name is already in use and that the connection opened with another name, which can be requested with the function call sk_getConnectionName.

Useful Related Functions

int sk_getConnectionName();

int sk_closeConnection();

int sk_getLLCSocketDescriptor();

Internet Protocol. Part of the TCP/IP family of protocols used to route messages and tracks the addresses of nodes.