Modelica_DeviceDrivers icon indicating copy to clipboard operation
Modelica_DeviceDrivers copied to clipboard

Allow TCP server and client blocks in the same model

Open bernhard-thiele opened this issue 3 years ago • 1 comments

At the moment it is a bit cumbersome to get started with the TCP/IP blocks since it is not possible to have them in the same example model as is possible for all other communication blocks.

A first experiment has shown following issues:

  1. The client block needs to connect to a running server during initialization and blocks until the connection is established. It needs to be ensured that the server is started before the client tries to connect, otherwise simulation progress is dead locked.

  2. The intertwined server and client receive/send results in a infinite blocking even if server is started before the client.

Issue 1. can be ensured by suitable logic within Modelica, but it seems that 2. needs changes in the C code. One option is to run the server read and write in a detached thread. Maybe it is also possible to avoid blocking by supporting non-blocking I/O in both, client and server.

bernhard-thiele avatar Oct 21 '20 17:10 bernhard-thiele

Note: Also handle broken pipe errors in the server code (client disconnects) as non fatal and recover gracefully

bernhard-thiele avatar Oct 22 '20 10:10 bernhard-thiele