OpenSCADAWiki: Home Page En/Doc/ Sockets ...

Home | Каталог | Изменения | Комментарии | Пользователи | Регистрация | Вход  Пароль:  
 

The module <Sockets> of the subsystem "Transports"

Module: Sockets
Name: Sockets
Type: Transport
Source: tr_Sockets.so
Version: 2.3
Author: Roman Savochenko, Maxim Kochetkov, Maxim Lysenko (2009-2010)
Description: Provides sockets based transport. Support inet and unix sockets. Inet socket uses TCP, UDP and RAWCAN protocols.
License: GPL

Оглавление

Introduction

Transport module Sockets provides support of transport based on the socket to the system. incoming and outgoing transport, based on internet sockets: TCP, UDP and UNIX sockets are supported. Addition of the new incoming and outgoing sockets can be done through the configuration of the transport subsystem in any system configurator of OpenSCADA.

1. Incoming transports

Configured and running incoming transport opens the server socket for the expectation of connection of the clients, besides initiative connection. In the case of the UNIX socket, the UNIX socket file is created. TCP and UNIX sockets are multi-stream, ie when the client connects to a socket of these type, the client socket and the new stream in which the client is served are created. 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 realize receiving for CAN frames from the interface according to the configured filter.


Each incoming socket is associated with one of the available transport protocols, to which incoming messages are transmitted. In conjunction with the transport protocol is supported by a mechanism of the combining of pieces of requests, disparate while transferring.


Configuration dialog of the incoming socket is depicted in Figure 1.


Configuration dialog of the incoming socket. (105 Кб)
Fig.1. Configuration dialog of the incoming socket.

Using this dialog you can set:

 (2 Кб) Empty value for the protocol selection switch the transport to mode of creation associated output transports for each connection to the input transport.
The associated output transports mode for the input transport demands allowing some external for the transport procedure which serve as the protocol which must go through all associated output transports, and do requests to read or write-read.
 (2 Кб) The procedure missing will necessarily come to growing the associated output transports by miss an essence causes the closed connection transport stopping and next allowing for remove the stopped output transports by the input transport.
 (2 Кб) We do not recommend disable the function by the TCP/IP network's properties does not guarantee notice the server about the connection disable, for example after power supply lost on the client. As result the opened client connections will left forever and after its number achieve to the limit server will drop new connections!

Features of the formation of addresses of incoming sockets are shown in the table below:

Socket's typeAddress
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. There may be as symbolic as well as IP presentation of address.
  • port – Network port, on which the socket is opened. Indication of the character name of the port (according to /etc/services) is available.
  • mode – mode of working of the incoming socket:
    • '0' — Force closing the connection after the session reception-response.
    • '1' — Do not close, only by KeepAlive parameters.
    • '2' — Initiative connection. Enables mode for initiative the input transport connection to remote host (the address instead of locale) and go to waiting for requests from the host. Value "Keep alive timeout (sek.)" uses as timeout for the transport reconnection by activity lack, for restoring possible the connection lose.

Example: "TCP::10001:1" — TCP-socket is available on all interfaces, is opened on port 10001 and doesn't close the connection.

UDP

UDP:{address}:{port}
where:

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

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

RAWCAN

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

  • interface — CAN interface's name;
  • mask, identifier — mask and identifier for filtering CAN frames.

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

UNIX

UNIX:{name}:{mode}
where:

  • name — UNIX socket file name;
  • 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. Outgoing transports

Configured and running outgoing transport opens a connection to the specified server. In the case of destroying of the connection, outgoing transport is disconnected. In order to resume the connection transport must be re-run.


Main tab of the configuration page of outgoing socket is shown in Fig.2.


Main tab of the configuration page of the outgoing socket. (81 Кб)
Fig.2. Main tab of the configuration page of the outgoing socket.

Using this dialog you can set:


The addresses of outgoing sockets of different types are formed as follows:

Socket's typeAddress
TCP/UDP

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

  • address — Address to which the connection is performed. There may be as the symbolic representation as well as IP one of the address.
  • port — Network port, with which the connection is made. Indication of the character name of the port is available(according to /etc/services).

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

RAWCAN

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

  • interface — CAN interface's name;
  • 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 — UNIX socket file name.

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

Links

Страницы, ссылающиеся на данную: HomePageEn/Doc
HomePageEn/Doc/BFN
HomePageEn/Doc/DAQ
HomePageEn/Doc/OPCUA
HomePageEn/Doc/QuickStart
HomePageEn/Doc/Serial
HomePageEn/Function
HomePageEn/Using/APIFunctionLibs/LibUserPrtDevs
HomePageEn/Using/PLC/firmware
HomePageEn/Using/SmartHouse

 
Много файлов (3).[Показать файлы/форму]
Комментариев нет. [Показать комментарии/форму]