You are here: Start » Tutorial Exercises » TCP/IP: Shoutbox Server
TCP/IP: Shoutbox Server
Aim:
Create a TCP server that receives text messages and displays them in the HMI.
Input:
There will be an incoming connection on TCP port 12345, and consecutive text messages will be sent as lines of text.
At this stage of the training program, we have no client application, so for testing purposes we will use the command-line tool "telnet".
Please, turn it on in Control Panel > Programs > Turn Windows features on or off > Telnet Client.
When the server is ready, open the Windows Command Prompt and issue the following command:
telnet localhost 12345
or if accessing the server from another computer:
telnet <ip-address> 12345
Then we will type consecutive text messages.
Output:
The server should accept the connection and then display received text messages in the HMI.
Hints:
Use the TcpIp_Accept filter to accept the connection from a client. In the default configuration, it will wait forever until the client is connected.
Use the TcpIp_ReadLine filter to receive one text message. Its input must be connected with the output of the TcpIp_Accept filter.
Labeling connections is explained in this article.
You can learn how to turn on sections here.
Solution (FIS)
►Click here to show the solution.
Further Readings
- TCP/IP Networking - Detailed information about using TCP/IP filters.