eeros_architecture:control_system:available_blocks:socket
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
eeros_architecture:control_system:available_blocks:socket [2017/08/09 11:50] – graf | eeros_architecture:control_system:available_blocks:socket [2021/04/22 12:20] (current) – [Parameters] ursgraf | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Socket Data ====== | ====== Socket Data ====== | ||
- | A socket data block allows for sending or receiving signal values to or from a remote station over a socket connection. This can be used to gather signals from a sensor or send signals to an remote control unit. Upon instantiation the block will create a socket server which runs in its own thread. Any socket client can now connect to this server. After a connection is established the two can send or receive any type of signal. \\ | + | A socket data block allows for sending or receiving signal values to or from a remote station over a socket connection. This can be used to gather signals from a sensor or send signals to an remote control unit. Upon instantiation the block will create a socket server |
A socket data block can have zero or one input. The first template parameter indicates the type of the input signal while the second parameter denotes the type of the output signal, e.g.: | A socket data block can have zero or one input. The first template parameter indicates the type of the input signal while the second parameter denotes the type of the output signal, e.g.: | ||
<code cpp> | <code cpp> | ||
Line 12: | Line 12: | ||
===== Parameters ===== | ===== Parameters ===== | ||
- | When constructing a socket data block you can pass the ip-address | + | When constructing a socket data block you can pass the ip-address, the port number, |
+ | The period of the internal thread determines the transceiver frequency. | ||
<code cpp> | <code cpp> | ||
- | SocketData< | + | SocketData< |
</ | </ | ||
- | Input and output signals will be transmitted twice per second. A remote client would have to connect to the ip-address 146.136.36.102. | + | A socket server is established. |
+ | <code cpp> | ||
+ | SocketData< | ||
+ | </ | ||
+ | This creates a socket client. Input and output signals will be transmitted twice per second. The client connects to a server on the ip-address ' | ||
+ | |||
+ | Both server and client transmit and receive with a thread frequency of 0.5s. It makes sense to choose the same frequency for both partners. If one of them has a lower frequency, the communication will happen with this lower frequency. | ||
+ | The last parameter is the timeout time. If not specified, it will be 1 second. This is the time a socket data block tries to read from a socket connection. If the other side suddenly stops the connection, the socket data block will stop trying to read after this timeout out and will report a message. | ||
+ | ===== Miscellaneous ===== | ||
+ | As soon as a client connects to a socket server a connection is up and running until either one of them stops. It is possible to stop the server or the client and restart it subsequently. In both cases a new connection will be established. \\ | ||
+ | As long as the connection is not yet open the '' |
eeros_architecture/control_system/available_blocks/socket.1502272259.txt.gz · Last modified: 2017/08/09 11:51 (external edit)