Loading [MathJax]/extensions/tex2jax.js

You are here: Start » Tutorial Exercises » TCP/IP: Shoutbox Client (tcpip_shoutbox_client)

TCP/IP: Shoutbox Client (tcpip_shoutbox_client)

Aim

Create a TCP client which connects to a server and sends text messages typed by the user in the HMI.

Input

The input is the text message typed by the user in the HMI.

Output

The client should connect to the server and send the typed message whenever the user clicks a "Send" button.

The client should disconnect and close when the user clicks an "Exit" button.

Hints

Use the TcpIp_Connect filter to connect to the server.

Create a Task macrofilter to handle multiple interactions. Add the TcpIp_WriteText filter to send one text message and the Loop filter to create a loop in the macrofilter. The input of the TcpIp_WriteText filter has to be connected with the output of the TcpIp_Connect filter (via the input of the task macrofilter).

Create an "Exit" button in the HMI (with ImpulseButton control) and connect it to the Loop filter in such a way, that the loop breaks when the button is pressed (you should use the Not filter to negate the condition).

Add another button, "Send" to send text messages only on a user request. Use the MakeConditional filter to create a conditional String (a copy of the text-box content) only when the button is pressed.

Solution (FIS)

►Click here to show the solution.

Further Readings