From OpenSCADAWiki
Jump to: navigation, search
Other languages:
Module Name Version License Source Languages Platforms Type Author Description
Sockets Sockets 2.8 GPL2 tr_Sockets.so en,uk,ru,de x86,x86_64,ARM Transport Roman Savochenko, Maxim Kochetkov
Maxim Lysenko (2009-2010) — the page translation
Provides sockets based transport. Support network and UNIX sockets. Network socket supports TCP, UDP and RAWCAN protocols.

The module provides support for sockets based transports to the program. Input and output transports is supported, based on network sockets TCP, UDP and UNIX. You can add new input and output sockets through the configuration of the transport subsystem in any OpenSCADA configurator.

1 Input transports

Configured and running input transport opens the server socket for the expectation of connection of the clients, besides the initiative connections. In the case of the UNIX socket, the UNIX socket file is created. TCP and UNIX sockets are multi-stream, i.e. when the client connects to a socket of these type, the client socket and the new thread are created in which the client is served. Server socket in this moment switches to the waiting for the request from the new client. Thus the parallel service of the clients is achieved. RAWCAN socket accepts CAN frames from the interface according to the configured filter.

Each input socket is associated with one of the available transport protocols, to which input messages are transmitted. Together with the transport protocol, the mechanism of combining fragmented pieces when sending requests is supported.

Configuration dialog of the input socket is shown in Figure 1.

Fig.1. Configuration dialog of an input socket.

This dialog allows you to set:

  • State of the transport, that is: status, "Running", name of the database (containing the configuration) and information about the active connections.
  • Identifier, name and description of the transport.
  • Address of the transport. The format of the address is listed in the table below.
  • Selecting of the transport protocol.
At.png Empty value of the protocol selection switches the transport mode to creating the associated output transports for each connection to that input.
The associated output transports mode for the input transport demands for presence some external for the transport procedure, which serve as the protocol and which must go through all the associated output transports and do requests to read or write-read.
At.png The procedure missing will necessarily come to growing the associated output transports by miss an essence, which stops transports with closed connections and the ability to next remove the stopped output transports by this input.
  • State "Running", in which the transport must be switched at start up.
  • Length of the socket queue, maximum number of clients to serve, maximum number of clients to serve per host and the input buffer.
  • Priority of the transport tasks .
  • Maximum segment size (MSS), for limit the transmitted packages size (segments TCP) on bad link channels. Set to 0 for disabling the user limit for size.
  • Keep alive requests — closing the connection after specified number of the requests. Zero value for disabling — never closes.
  • Keep alive timeout, seconds — closing the connection after missing requests within a specified time. Zero value for disabling — never closes.
At.png Disabling this feature is not recommended because the TCP/IP network property does not guarantee the server notification about the disconnection, say in the event of a power failure on the client. As a result, the opened client connections can remain forever, and when the limit is reached the server will stop accepting new ones!

Features of the formation of the input socket address are given in the table below:

Socket type Address
TCP

TCP:{address}:{port}:{mode}
where:

  • address – address, on which the socket is opened. It must be one of the addresses of the host. If nothing is specified, the socket will be available in all the host interfaces. Both symbolic and IP representing of the address are allowed.
  • port – network port, on which the socket is opened. Indication of the symbolic name of the port (according to "/etc/services") is available.
  • mode – mode of the input socket working:
    • 0 — force closing the connection after the session reception-response.
    • 1 — do not close, only by the KeepAlive parameters.
    • 2 — initiative connection. Enables the mode of connecting this input transport to the remote host (address instead of local) and switching to the listening state of this host. The "Keep alive timeout" value is used as the timeout of the re-connection of this transport in the absence of activity in order to restore the possibly lost connection.

Example: "TCP::10001:1" — The TCP socket is available on all interfaces, opened on port 10001 and the connection does not break.

UDP

UDP:{address}:{port}
where:

  • address — the same as in the TCP;
  • port — the same as in the TCP.

Example: "UDP:localhost:10001" — The UDP-socket is only available on the "localhost" interface and opened on the port 10001.

RAWCAN

RAWCAN:{interface}:{mask}:{identifier}
where:

  • interface — name of the CAN interface;
  • mask, identifier — mask and identifier for filtering CAN frames.

Example: "RAWCAN:can0:0:0" — is receiving all CAN frames at the interface "can0".

UNIX

UNIX:{name}:{mode}
where:

  • name — file name of the UNIX socket;
  • mode — the same as in the TCP.

Example: "UNIX:/tmp/oscada:1" — UNIX-socket is available through the file "/tmp/oscada" and it doesn't close the connection.

2 Output transports

Configured and running output transport opens a connection to the specified server. In the case of destroying the connection, output transport is stopped. In order to resume the connection transport must be re-run, that all protocols do automatically.

Main tab of the configuration page of an output socket is shown in Figure 2.

Fig.2. Main tab of the configuration page of an output socket.

This dialog allows you to set:

  • State of the transport, that is: status, "Running" and the name of the database, containing the configuration.
  • Identifier, name and description of the transport.
  • Address of the transport. The format of the addresses is listed in the table below.
  • The state "Running", in which the transport must be translated at start up.
  • Maximum segment size (MSS), for limit the transmitted packages size (segments TCP) on bad link channels. Set to 0 for disabling the user limit for size.
  • Connection timings in the format "conn:next[:rep]". Where:
    • conn — maximum connection waiting time, in seconds;
    • next — maximum time for waiting the continue of the response, in seconds;
    • rep — minimum delay time for next request, in seconds.

Addresses of output sockets of different types are formed as follows:

Socket type Address
TCP/UDP

TCP:{address}:{port}
UDP:{address}:{port}
where:

  • address — address with which the connection is made. Both symbolic and IP representation of the address are allowed.
  • port — network port, with which the connection is made. Indication of the symbolic name of the port is available (according to "/etc/services").

Example: "TCP:127.0.0.1:7634" — connecting to the port 7634 on the host 127.0.0.1.

RAWCAN

RAWCAN:{interface}:{mask}:{identifier}
where:

  • interface — name of the CAN interface;
  • mask, identifier — mask and identifier of the CAN frames.

Example: "RAWCAN:can0:0:0" — receiving all CAN frames at the interface "can0".

UNIX

UNIX:{name}
where:

  • name — file name of the UNIX socket.

Example: "UNIX:/tmp/oscada" — connecting to the UNIX-socket through the file "/tmp/oscada".