Embedded TCP/IP stack
4.1.0
|
TELNET server API
Detailed Description
The Telnet server provides a simple command-line interface for a remote host via a virtual terminal connection.
Current version of the Telnet server supports maximum of one simultaneously connected Telnet client.
After the FNET Telnet server is initialized by calling the fnet_telnet_init() function, the user application should call the main service polling function fnet_service_poll() periodically in background.
For example:
...
{
fapp_telnet_cmd_table,
"TELNET>",
fapp_shell_on_init,
};
...
void main()
{
struct fnet_telnet_params params;
...
params.ip_address = FNET_HTONL(INADDR_ANY);
params.port = FNET_HTONS(0); //Default port number.
params.shell= &fapp_telnet_shell;
params.cmd_line_buffer = fapp_telnet_cmd_line_buffer;
params.cmd_line_buffer_size = sizeof(fapp_telnet_cmd_line_buffer)
// Init Telnet server.
fapp_telnet_desc = fnet_telnet_init(¶ms);
if(fapp_telnet_desc)
{
fnet_printf("\n FNET Telnet server started.\n");
while(1)
{
// Do something.
...
}
}
else
{
fnet_printf("\n FNET Telnet server initialization is failed.\n");
}
}
For Telnet usage example, refer to FNET demo application source code.
Configuration parameters:
- FNET_CFG_TELNET
- FNET_CFG_TELNET_SESSION_MAX
- FNET_CFG_TELNET_PORT
- FNET_CFG_TELNET_SHELL_ECHO
- FNET_CFG_TELNET_SOCKET_BUF_SIZE
Data Structures | |
struct | fnet_telnet_params |
Input parameters for fnet_telnet_init(). More... | |
Typedefs | |
typedef void * | fnet_telnet_desc_t |
Telnet server descriptor. More... | |
Functions | |
fnet_telnet_desc_t | fnet_telnet_init (struct fnet_telnet_params *params) |
Initializes the Telnet Server service. More... | |
void | fnet_telnet_release (fnet_telnet_desc_t desc) |
Releases the Telnet Server service. More... | |
void | fnet_telnet_close_session (fnet_telnet_desc_t desc) |
Closes the currently active session of the Telnet Server. More... | |
fnet_bool_t | fnet_telnet_is_enabled (fnet_telnet_desc_t desc) |
Detects if the Telnet Server service is enabled or disabled. More... | |
© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net