This is a very simple example to show the TCP communication functionality. A feedback control is modeled where a gain controller controls a first order system. The signal is send to a server which returns the send message unaltered back to the client.
A server to test ExampleClientLoop
is provided both as a
source code
*.cpp-file and as an executable
*.exe-file. The server simply echoes the received character
message and sends it back to the sender (i.e. client). The code may
be compiled and executed from the console. This code is taken from
Microsoft's Winsock documentation pages:
Link to MSDN
Open a console in Windows (Start -> Run -> insert: "cmd"),
change folder to
.../AixLib/Resources/SocketCommunicationServer
, run
ExampleServer.exe
. The Server is now ready to operate.
Now simulate ExampleClientLoop
.
Note: Depending on your network settings it may be required to change
the IP address in
ExampleClientLoop.tCPCommunicatorExample
. Set the IP
address to the IP address of your local machine. (You may retrieve
your local IP address in Windows from the console (Start -> Run
-> insert: "cmd" -> ipconfig)).
This example and the executable have been tested on Windows 7 64-bit using Dymola 2015 32-bit.