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

sk_createConnection()

Description

Use the SK_Connection *sk_createConnection() function to create a connection between your application module and a specific LLC.

Important! If you are using the function sk_appDescriptionData(), the aLabel argument in sk_createConnection() matches anAppName in sk_appDescriptionData().

Syntax

SK_Connection *sk_createConnection(const char *aLabel, int anAppID, int isForcedFlag, const char *aPriHost, int aPriPort, const char *aBackupHost, int aBackupPort);

int *skts_createConnection(int aConID, const char *aLabel, int anAppID, int isForcedFlag, const char *aPriHost, int aPriPort, const char *aBackupHost, int aBackupPort);

Parameters

The function parameters are shown in the next table.

Argument | Description
--- | ---
aConID | aConID is a connection identifier specified by the application and used to refer to an application’s connection to a specific LLC. The connection identifier is used by the SwitchKit API to route messages from the application to a specific LLC. The connection identifier is initially defined for the API when the application calls sk_createConnectionWithID() or skts_createConnection() and should be used for any sk_*OnConnection() and skts_*() functions where required.
aLabel | aLabel is a text string used by the application to identify the connection. The value has no meaning to the SwitchKit API and is available for query via sk_getSpecificConnectionLabel() and skts_getSpecificConnectionLabel().
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.
isForcedFlag | If isForcedFlag equals 1, then the application identifier for this application will be set to the value specified in anAppID even if that application identifier is being used by another application.
aPriHost | The IP address of the primary LLC with the following format, for example: "10.10.55.10"
aPriPort | The IP port number the primary LLC the primary LLC is listening to.
aBackupHost | The IP address of the secondary LLC, in the following format, for example: "10.10.55.10". If there is no secondary LLC, this field should be set to "". That is, the 0-length string.
aBackup Port | The IP port for the secondary LLC is listening to.

Return Values

sk_createConnection() is one of the functions that returns an integer value instead of a pointer. A NULL pointer indicates an error condition.

*skts_createConnection() returns- returns the following values:

aConID if connection successful or previously created

SK_ERROR_CREATING_CONNECTION (negative integer) if connection fails

Useful Related Functions

int sk_getLLCSocketDescriptor();

int sk_getSpecificConnectionName();

const char *sk_getSpecificConnectionLabel();

SK_Connection *sk_getCurrentConnection();

void sk_setCurrentConnection();

int sk_destroyConnection();

int sk_appDescriptionData();

Internet Protocol. Part of the TCP/IP family of protocols used to route messages and tracks the addresses of nodes.
The point in the Excel platform where a DS0 connects to a network. Also known as a "socket."