beautypg.com

Chapter 5: module-independent functions, 1 overview, 2 api initialization and shutdown – Sensoray 2410 API User Manual

Page 12

background image

Sensoray 24xx Programming Guide

8

Module-Independent Functions

Chapter 5: Module-Independent Functions

5.1 Overview

The API functions discussed in this chapter are common to all I/O module types.

5.2 API Initialization and Shutdown

5.2.1 s24xx_ApiOpen()

Function:

Open and initialize the API.

Prototype:

BOOL s24xx_ApiOpen( void );

Returns:

Returns a non-zero value if successful, or zero if the operation failed. This can fail if the version number of the
socket API is incompatible with middleware, or if TCP/IP is not properly configured on the client.

Notes:

s24xx_ApiOpen()

must be successfully invoked before any other middleware functions are called. Each client

process must call this function exactly once. A multi-threaded application must invoke this once before any other
API functions are called by any of the application’s threads.

Example:

See section 5.4.1.

5.2.2 S24xx_ApiClose()

Function:

Close the API.

Prototype:

void s24xx_ApiClose( void );

Returns:

None.

Notes:

If an earlier call to

s24xx_ApiOpen()

was successful, this function must be called before the application closes to

ensure that the API shuts down gracefully and properly releases all resources. If an error code was returned by

s24xx_ApiOpen()

, however, the application should not call

s24xx_ApiClose()

. This must be the last API

function called by the application.

Example:

See section 5.4.1.