This example shows how the Telnet server can be used to implement a Command Line Interface (CLI) to interact with the device.
The following picture shows an exemplary connection of the development board and a Computer.
The Telnet Server project is available as part of the Network Reference examples.
Following files implement application-specific logic in the example:
Telnet_Server.c contains the application main thread which initializes the Network Component.Telnet_Server_UIF.c defines the functions for the user interface and all the available CLI commands.You can add the following optional files, which are not included in the project by default:
Telnet_Server_Multiuser.c is used for specifying multiple users and access rights for these users.Telnet_Server_Access.c enables the server to accept or block connection requests from certain remote clients.Configuration files for the software components used in the project are located in the ./RTE/ directory and can be modified by users to adjust the operation of related components.
Following configuration files are provided with this example:
./RTE/Network/ folder:Net_Config_Telnet_Server.h: Telnet Server configurationNet_Config_TCP.h: TCP Socket configurationNet_Config_UDP.h: UDP Socket configurationNet_Config_ETH_0.h: Ethernet Interface configurationNet_Config.h: Network Core configurationNet_Debug.h: Network Debug configuration./RTE/CMSIS/ folder:RTX_Config.h and RTX_Config.c: CMSIS-RTX Configuration files for the RTOS KernelWhen a board layer is added to the project, corresponding configuration files for the board and device components will become available in the local ./Board/ directory.
In order to build the project it shall be extended with a compatible board layer that provides following interfaces as connections:
CMSIS_ETH: CMSIS-Driver for Ethernet interfaceCMSIS_VIO: CMSIS-Driver for Virtual I/O interfaceSTDIN: Standard Input redirectionSTDOUT: Standard Output redirectionWorking with MDK-Middleware Examples explains the workflow for accessing, configuring and building an MDK-Middleware example project for your target hardware.
Setup
Board-specific hardware setup such as jumpers, Ethernet ports, power supply, etc. is documented in the board layer description (README.md) of your selected target.
Example execution
For opening a Telnet session to your development , you need a Telnet client on the host PC, for example PuTTY.
In the Telnet client use my_host (or the respective hostname that you have chosen in the Net_Config.h file) as the host name and use the standard Telnet port 23.
You will be asked for a username and password combination. Use admin for the user name and no password (you can change the defaults in the Net_Config_Telnet_Server.h file). After a successful log in, enter help command and you should see the list of available commands like this: