int __stdcall SM_OpenSecure ( SM_HANDLE *  handle,
char *  connection,
int  securityMode,
char *  securityKey 
)

Opens a secure connection to a Sealevel I/O module.

Parameters
[out]handleSeaMAX handle. This integer will be filled with a valid handle for future SeaMAX operations after a successful open.
[in]connectionString representing the connection to open. For Modbus TCP, the ":502" does not have to be specified.
[in]securityModeType of encryption to use.
[in]securityKeyC String representing the encryption key in hexadecimal characters
Return values
0Success.
-1Parameter 'connection' is null.
-2Could not determine connection type.
-3Invalid connection string.
-20Ethernet: Could not resolve host address.
-21Ethernet: Host refused or unavailable.
-22Ethernet: Could not acquire free socket.
-23Ethernet: Could not acquire a valid mutex.
-24Ethernet: Unknown error establishing connection.
-25Ethernet: Invalid key.
-26Ethernet: Unable to load cbx_enc_2_1.dll.

This method establishes an Ethernet connection, such as the SeaI/O E or W series module, and a connection string formatted as "x.x.x.x:y" for a dotted notation socket and port connection, or "x:y" for a host name and port is required for the connection parameter. If the 'y' (TCP/IP port) part of the connection is not specified, the default Modbus TCP port of 502 will be selected as default.

For example, the connection string "10.0.0.1" will establish a socket-based connection on port 502 with a device having the IP Address "10.0.0.1".

For securityMode values, see Security Type.

The securityKey parameter must include a C String (null terminated) containing two hexadecimal characters per byte of encryption. For example, an AES 256 key would be represented as 64 hexadecimal characters: "0102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F20".

Note
For Modbus compliant devices (such as the SeaI/O modules), a default slave ID of 247 is used for all SeaMAX functions. To read, write, or configure a module at an address other than 247, please refer to the SM_SelectDevice() function for more details.
Warning
The handle returned by SM_OpenSecure is not compatible with any of the other SeaMAX modules such as the SME (Ethernet Configuration) module or the SeaDAC SDL module. Only functions beginning with SM_ should use the handle returned by SM_OpenSecure().
 
 
Generated on Mon Nov 26 2018.