![]() |
Network Dual-Stack Component
Version 7.0 (Beta)
MDK-Professional Middleware for IP Networking
|
Functions to work with the Telnet server. More...
Functions to work with the Telnet server.
Like all services, the Telnet server is normally started automatically if Start System Service is enabled in the Net_Config.c configuration file. If it is disabled, the Telnet server needs to be started manually in the user application using netTELNETs_Start. At runtime, it is always possible to stop the Telnet server using the function netTELNETs_Stop. The user application can check for a running server using the netTELNETs_Running function.
To change the port of the Telnet server at runtime, first call netTELNETs_Stop (if the server is running) and then use the netTELNETs_SetPort function. Afterwards, the Telnet server needs to be (re-)started by the application calling netTELNETs_Start.
Code Example
The Telnet server supports a built-in user account if the TELNET_SERVER_AUTH_ADMIN
is set to 1. In this case, the user specified by TELNET_SERVER_AUTH_USER
is created and the password TELNET_SERVER_AUTH_PASS
is used for this user. The Telnet server control interface provides functions to work with this built-in account. To retrieve the username in the application, use netTELNETs_GetUsername. To change this username at runtime, use netTELNETs_SetUsername. The same pair of functions is available for managing the password (netTELNETs_GetPassword/netTELNETs_SetPassword).
It is also possible to check if this login is active (netTELNETs_LoginActive) and to enable or disable it at runtime using netTELNETs_LoginOnOff. Please note that the function netTELNETs_LoginOnOff is only available at runtime if the define TELNET_SERVER_AUTH_ENABLE
is set to 1 in the Net_Config_Telnet_Server.h file. Otherwise, this command will not be compiled into the project to save resources. For more complex account management, use the Access and Multi-User Interface.
The command line interface functions are located in the Telnet_Server_UIF.c template file. You must add this file to your project and customize it. You can add new commands or remove existing commands from the file. To add the template file to your project, simply right-click on the Source group, select Add New Item to Group, then click on User Code Template and scroll in the template files list until you find the Telnet Server template.