Serial to Ethernet Connector can be configured and used by passing commands in a specific format to its service (sec_service.exe).
To pass an XML structure to the service, use the following parameter:
All changes applied (add, remove, modify connections, etc.) are automatically synchronized with the corresponding changes in the registry.
XML Blocks
The service accepts XML configuration blocks with the following structure:
The opening and closing proto tag indicate the beginning and ending of an XML block. The version attribute indicates the protocol version (6.0 by default).
The operation tag (one or multiple) specifies the command to be executed by the service. It requires the type attribute that indicates the command name. If an error occurs, all commands return ERROR.
ADD and UPDATE commands should contain connection inner tag, which, in its turn, includes the connection description.
type – describes connection type. The possible values are: client, server, udp.
name – describes connection name, e.g. Client_COM1.
port – describes COM port settings
protocol – describes data transmission protocol settings
network – describes networking settings
security – describes security settings
proxy – describes proxy server settings
ctrlsconn – describes signal lines states when connection is established
ctrldisconn – describes signal lines states when connection is not established
port section
COM port settings. Includes the following options:
name – COM port name
sendmode – data transfer parameters.
May have two attributes:
mode – numerical value, the type of packets transfer mode
param – additional obligatory parameter
The list of possible modes and their values:
Mode | Transmission algorithm | Attribute meaning |
---|---|---|
1 | Add pause between packets | timeout in msec |
2 | Before sending data wait for | timeout in msec |
3 | Send data when block reached the size of specified value | buffer size in bytes |
4 | Send data when received char with code | ASCII code of char |
type – COM port type: virtual or real stricted – indicates whether strict baud rate is enabled
Possesses enable attribute, which can be either 1 or 0 correspondingly. E.g.:
– strict baud rate is enabled.
settings – describes or sets COM port parameters in the following format: baudrate,databits,parity,stopbits,flowcontrol.
E.g.:
protocol tag
May contain the following tags:
type – indicates protocol type; can be either RAW or TELNET.
E.g.:
access – used in RAW protocol. Applicable both to server and client; restricts data transmission over the network. Possesses two numerical values: write and read.
E.g.:
paired – available only for telnet protocol; indicates “Notify remote host on local port settings change” option state.
enable attribute may have one of the following values:
1=enabled
0 = disabled
telnet – sets response rules when control lines for telnet RFC protocol change.
dtr, rts and dcd attributes indicate whether control line change is allowed or not by taking 1 or 0 value correspondingly.
dcd is ignored if real serial port is used.
dtr and rts attributes manage DTR and RTS signal lines.
If virtual port is used, dtr, rts and dcd parameters manage DSR, CTS and DCD signal lines correspondingly.
E.g.:
– changes are not allowed.
reconnect – sets “On error retry to establish connection every” option parameters.
timeout numeric attribute sets reconnection interval in milliseconds.
enable numeric attribute may have one of the following values:
1=enabled
0 = disabled
portopencondition – this option value depends on the connection type as well as on the port type used in the connection.
The possible values are the following:
enable attribute is used to enable or disable portopencondition option with 1 or 0 value respectively.
dynamic – controls Allow changing local port settings option (for real ports only).
Enable attribute is used to enable or disable this option with 1 or 0 value respectively.
maxconnections – the possible maximum number of connections to the server.
Applicable only to SERVER connection type.
network tag
May include:
nagle – enables/disables Nagle algorithm.
Applicable only to CLIENT and SERVER connection types.
enable attribute can be set either to 1 or 0.
keepalive – configures “Keep Alive” messages sending:
enable attribute:
1= sending “Keep Alive” messages is on,
0 – off.
timeout – sets the interval of sending “Keep Alive” messages in milliseconds.
noreply – the interval of sending “Keep Alive” message if the response was not received from the remote computer.
break – sets “Break connection if no activity for” option behavior.
enable attribute indicates whether this option is enabled or not.
timeout attribute indicates the interval in milliseconds after which connection should be broken
incomeport – applicable to SERVER and UDP connection types.
Includes port attribute, which indicates a TCP port, on which the server listens to incoming connections.If this parameter is edited via UPDATE command, the current connection will be broken.
host – applicable to CLIENT and UDP connection types. Indicates remote host to be connected to.
Includes two attributes:
name and port– indicate hostname (IP address) of the remote computer and the port to connect to.
network may have several tags of such type.
security tag
auth – sets authorization options. Has the following attributes:
dll – name of DLL, which sets the password authorization in connections;
auth.dll is used by default.
pwd – sets password encryption. The following algorithm is used:
Every password symbol is encrypted with XOR logical operation with -1.
The result is generated into the string in hexadecimal format and is put at the end of the resulting string. So the resulting string contains the set of hexadecimal numbers – the encrypted password.
enable – enables/disables authorization, the latter breaking active current connections.
crypt – encryption of communication data. The following attributes are available:
dll – name of DLL, which encrypts all the communication data.
crypt.dll is used by default.
enable – enabled/disabled encryption:
1 – enabled
0 – disabled
proxy tag
Configures proxy server settings for connection of CLIENT type.
The following settings are available:
type – sets proxy server’s type: HTTP, SOCKS4, SOCKS5
dns – numerical attribute managing “Redirect DNS requests to proxy server” option; has the following values: 0 or 1.
E.g.:
host – this tag sets server parameters via name and port attributes, which set name/IP address of the proxy server and TCP port to connect to.
auth – sets proxy server authorization.
user and pwd attributes set user name and password correspondingly.
If user attribute is not set or is empty, authorization is considered to be disabled. The password is stored encrypted. Every password symbol is encrypted with XOR logical operation with -1.
The result is generated into the string in hexadecimal format and is put at the end of the resulting string. So the resulting string contains the set of hexadecimal numbers – the encrypted password.
ctrlsconn and ctrldisconn tags
Manage signal lines states when connection is (ctrlsconn) or is not established (ctrldisconn).
May have the following attributes: dtr, rts and dcd.
dcd is ignored if real serial port is used.
dtr and rts attributes manage DTR and RTS signal lines.
If virtual port is used, dtr, rts and dcd parameters manage DSR, CTS and DCD signal lines correspondingly.
ADD command
Adds new connection.
If the command succeeds, it returns message of the following kind:
“ServerCOM4″ connection was created successfully”.
Otherwise, the error is returned. For example:
“Service returned the following error: Connection Server COM4 (Com port: COM4) is already presented in the connection list and will be omitted.”
New connection parameters are set in connection tag.
For example:
You can also add connections executing the following command:
UPDATE command
Updates connection settings.
Syntax:
For example, in this code the changes in COM port settings are being requested; the rest of the settings for the current connection will be automatically accepted as well.
In case when changes occur to TCP port on the server, the list of already connected active clients, data transmission protocol (RAW/TELNET) or security settings, the current connections will be broken.
This command does not change the type of connection. To do so, remove and add the connection once again.
You can also use the following command:
DELETE command
Deletes connection. Can delete several connections.
Syntax:
Working with the service
The list of command-line arguments accepted by the service is the following:
install – install the service
uninstall – uninstall the sevice
enable – start the service
disable – stop the service
reg – register the service
Here are some examples:
Service installation:
Service launching:
Online activation:
Offline activation: