Command Line Options

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:

sec_service.exe add /xml="<proto version=\"6.0\">
Note: The quotes should be escaped with a slash.

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:

<proto version="6.0"> 
<operation type="command_name" />
 
...
 
</operation>
</proto>

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:

ModeTransmission algorithmAttribute meaning
1Add pause between packetstimeout in msec
2Before sending data wait fortimeout in msec
3Send data when block reached the size of specified valuebuffer size in bytes
4Send data when received char with codeASCII 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.:

<stricted enable="1">

– strict baud rate is enabled.

settings – describes or sets COM port parameters in the following format: baudrate,databits,parity,stopbits,flowcontrol.
E.g.:

9600,8,N,1,P

protocol tag

May contain the following tags:

type – indicates protocol type; can be either RAW or TELNET.

E.g.:

<type>RAW</type>

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.:

<access write="0" read="1">

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.:

<telnet dtr="0" rts="0" dcd="0">

– 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.:

<proxy type="HTTP" dns="1"/>

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:

<proto version="6.0">
  <operation type="ADD">
    <connection>
      <type>CLIENT</type>
      <name>Client_COM1</name>
      <port>
        <name>COM11</name>
        <sendmode mode="2" param="0" />
        <type>Virtual</type>
      </port>
      <protocol>
        <type>RAW</type>
        <access write="0" read="1" />
        <reconnect timeout="5000" />
        <portopencondition enable="1" />
      </protocol>
      <network>
        <host name="localhost" port="5002" />
        <nagle enable="0" />
        <keepalive timeout="7000" noreply="1000" units="msec" enable="1" />
        <break timeout="10000" enable="1" />
        <incomeport port="5001" />
      </network>
      <security />
      <ctrlsconn dtr="0" rts="0" dcd="0" />
      <ctrldisconn dtr="0" rts="0" dcd="0" />
    </connection>
  </operation>
</proto>

You can also add connections executing the following command:

SEC_SERVICE ADD <path to an XML file>

UPDATE command
Updates connection settings.

Syntax:

SEC_SERVICE UPDATE <connection name> /xml="XML tags"

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.

sec_service.exe update "Server COM4" /xml="<proto version=\"6.0\"><operation type=\"UPDATE\"><connection><type>SERVER</type><name>Server COM5</name><port><name>COM5</name><sendmode mode=\"0\" param=\"0\" /><type>Virtual</type><stricted enable=\"0\" /><settings>9600,N,8,1</settings></port><protocol><type>RAW</type><access write=\"4\" read=\"4\" /><maxconnections value=\"25\" /><portopencondition enable=\"0\" /></protocol><network><nagle enable=\"1\" /><keepalive timeout=\"7000\" noreply=\"1000\" units=\"msec\" enable=\"0\" /><break timeout=\"10000\" enable=\"0\" /><incomeport port=\"5001\" /></network><security><auth enable=\"0\" dll=\"auth.dll\" pwd=\"\" /><crypt enable=\"0\" /></security><ctrlsconn dtr=\"1\" rts=\"1\" dcd=\"1\" /><ctrldisconn dtr=\"0\" rts=\"0\" dcd=\"0\" /></connection></operation></proto>"

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:

SEC_SERVICE UPDATE <connection name> <path to an XML file>

DELETE command
Deletes connection. Can delete several connections.

Syntax:

SEC_SERVICE DELETE <connection name>


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:

sec_service.exe install

Service launching:

sec_service.exe enable

Online activation:

sec_service.exe reg <key>

Offline activation:

sec_service.exe reg /offline=<path_to_file>