You are here: SwitchKit® Development Environment Programmer’s Guide > 2 Connection Management > Additional Functions used with One LLC

Additional Functions used with One LLC

sk_closeConnection()

The function closes the current connection between the application and the LLC.

Syntax

int sk_closeConnection();

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_getConnectionName()

The function call sk_getConnectionName() retrieves the name registered to the applications current connection between the application and the LLC.

Syntax

int sk_getConnectionName();

How getConnectionName works

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

sk_getLLCSocket
Descriptor()

The function sk_getLLCSocketDescriptor() 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_getLLCSocketDescriptor();

How getLLCSocketDescriptor works

By calling sk_getLLCSocketDescriptor(), your application retrieves the socket descriptor from the LLC, which enables your application to issue an OS-specific call, for example select(). This indicates when there is activity on the LLC socket and only then calls the function sk_rcvAndDispatch().

The sk_getLLCSocketDescriptor() function should be called each time select() is called, because the socket descriptor can change without the knowledge of the application.

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.