JoeScan
  home
our story
news  and events
contact us
    our products
how it works
applications support service

Managing Scanner Connections


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.


Functions

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

Function Documentation

JCAM_DLL_API JCONNECTION STDCALL 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:
host Can 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.

JCAM_DLL_API JCONNECTION STDCALL 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:
host Must 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.

JCAM_DLL_API JCONNECTION STDCALL 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:
host Must be in xxx.xxx.xxx.xxx format.
cableID The Cable ID of the scanner to connect to.
Returns:
The JCONNECTION on success.

NULL if a failure occurred.

JCAM_DLL_API int STDCALL 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:
jc The connection to be closed.
Returns:
0 on success.

-1 on all failures.