JCam DLL API Reference
Managing Scanner Connections

Functions

JCONNECTION jsOpenConnection (char const *const host)
 Opens a connection to the specified host. More...
 
JCONNECTION jsOpenConnectionInt (int const host)
 Opens a connection to the specified host. More...
 
JCONNECTION jsOpenConnectionBase (char const *const host, UINT32 const cableID)
 Opens a connection to the specified scanner using Base IP + Cable ID addressing. More...
 
int jsCloseConnection (JCONNECTION const jc)
 Closes a JCONNECTION. More...
 

Detailed Description

JCONNECTION's are allocated data structures that must be properly de-allocated; otherwise, there will be memory leaks in your program. Consequently, every successful call to jsOpenConnection() or jsOpenConnectionInt() must have a corresponding call to jsCloseConnection(). If the open call failed, the returned JCONNECTION will be NULL and the close call is not necessary, although it is perfectly safe.

After calling jsCloseConnection(), the JCONNECTION is an invalid pointer and should be set to NULL.

If a call fails, call WSAGetLastError() to get a more specific reason for failure according to Microsoft's documentation.

Function Documentation

◆ jsCloseConnection()

int jsCloseConnection ( JCONNECTION const  jc)

Closes a JCONNECTION.

It is safe to pass in NULL.

If a function returns SCANNER_FAILURE, you must close the connection with this function. JCONNECTION's are allocated data structures that must be properly deallocated, otherwise there will be memory leaks in your program.

See also
jsOpenConnection()
jsOpenConnectionInt()
jsOpenConnectionBase()
Parameters
jcThe connection to be closed.
Returns
0 on success.
-1 on all failures.

◆ jsOpenConnection()

JCONNECTION jsOpenConnection ( char const *const  host)

Opens a connection to the specified host.

All successful calls to this function must be closed with a call to jsCloseConnection().

See also
jsCloseConnection()
Parameters
hostCan be in either xxx.xxx.xxx.xxx format or can be a DNS name for lookup.
Returns
The JCONNECTION on success.
NULL if a failure occurred.

◆ jsOpenConnectionBase()

JCONNECTION jsOpenConnectionBase ( char const *const  host,
UINT32 const  cableID 
)

Opens a connection to the specified scanner using Base IP + Cable ID addressing.

All successful calls to this function must be closed with a call to jsCloseConnection().

See also
jsCloseConnection()
Parameters
hostMust be in xxx.xxx.xxx.xxx format.
cableIDThe Cable ID of the scanner to connect to.
Returns
The JCONNECTION on success.
NULL if a failure occurred.

◆ jsOpenConnectionInt()

JCONNECTION jsOpenConnectionInt ( int const  host)

Opens a connection to the specified host.

All successful calls to this function must be closed with a call to jsCloseConnection().

See also
jsCloseConnection()
Parameters
hostMust be in network byte order. The best way to get this is by using the Scanner Discovery functions.
Returns
The JCONNECTION on success.
NULL if a failure occurred.