Establishing a Connection with STK

Once you've initialized the AgConnect API, you need to open a connection to STK by using the AgConOpenSTK() function, whose prototype is:

AgConOpenSTK (
char **context,
char *notUsed,
char *connectName

The context argument points to a variable initialized to NULL. The function will return a unique value in the variable used to identify the connection. It is used to communicate low-level information about the connection within the AgConnect API.

The second argument is no longer used. Use the value NULL for this argument.

The connectName argument specifies the details of the connection. Specify the name of the host machine and its port number, separated by a colon (:). The following example shows a common value for connectName:


The same value for context that is passed here to AgConOpenSTK() along with connectName should be passed to subsequent Connect functions for that particular connection.

AgConOpenSTK returns AgCNoError if successful and AgCError if an error occurs.

Since there can be multiple connections to STK, it is important to remember which context argument belongs to which connection.

See the Connect Example File.

STK Engine for UNIX 11.2