Additional Functions to Connect to Multiple LLCs

sk_closeNamed
Connection()

This function closes the connection with the specified connection ID between the application and the LLC.

Syntax

int sk_closeNamedConnection( int aConID);

How closeConnection works

The LLC no longer has a socket open to this application. However, the ConnectionManager object remains and causes the connection to re-establish in case of subsequent calls to sk_rcvAndDispatch() or attempts to send a message.

sk_getConnectionNameForConnection()

The function call sk_getConnectionNameForConnection() uses the connection ID to retrieve the connection name of the connection between the applications and the LLC.

Syntax

int sk_getConnectionNameForConnection( int aConID);

How getConnectionName works

You can call this function only after opening a socket to the LLC. To open the socket, send a harmless message through that connection.

sk_getLLCSocket
DescriptorForConnection()

The function sk_getLLCSocketDescriptorForConnection() returns the socket descriptor associated with the current application. You need this function if your application is connected to the LLC, to a database, or to another server.

Syntax

int sk_getLLCSocketDescriptorForConnection( int aConID);

Threadsafe Syntax

int skts_getLLCSocketDescriptor(int aConID);

How getLLCSocketDescriptor works

By calling sk_getLLCSocketDescriptorForConnection() your application retrieves the socket descriptor associated with the specified connection ID from the LLC. This enables your application to issue an OS-specific call, for example select(). This indicates when there is activity on the LLC socket and then the application must call the function sk_rcvAndDispatch() to begin processing of all messages on the LLC socket.

The sk_getLLCSocketDescriptorForConnection() function should be called each time select() is called, because the socket descriptor can change without the application being aware of it.

For example, if the PLLC fails and the RLLC becomes active, the socket of the PLLC will no longer be valid. A subsequent call to the function provides the socket descriptor for the now active RLLC.

sk_getConnectionForID()

The function call sk_getConnectionForID() retrieves the SK_Connection object for the specified connection ID.

Syntax

SK_Connection *sk_getConnectionForID(int aConID);

sk_destroyConnection
Forced()

Your application should use the function sk_destroyConnectionForced() to destroy a connection to the LLC with the specified connection ID. If the specified connection is the last connection opened, it will be destroyed but cause a return value SK_NO_CONNECT_AVAIL. As the name implies, this return indicates that no connections remain. However, should your application call sk_rcvAndDispatch(), the system attempts to establish a connection to an LLC using the default connection arguments specified in the SK_LLC_Host/Port environment variables, or at local host:1312.

This function call frees up all the memory allocated in sk_createConnectionWithID().

Syntax

int sk_destroyConnectionForced(int aConID);

Threadsafe Syntax

int skts_destroyConnectionForced(int aConID);

Return Values

SK_NO_CONNECT_AVAIL

This return indicates that all connections have been destroyed.