We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
The callback function netTELNETs_ProcessCommand processes and executes the command requested by the Telnet client.
In my application, I have to send a list of message to answer to only one command request.
I've seen in the documentation that the function netTELNETs_RequestMessage is used to pass unsolicited messages to the Telnet server.
Is it possible to use this function to send several messages, and how can I use it ?
Thanks !
Thierry
It is possible to respond with a larger message, that does not fit into one response packet. The return value of the function netTELNETs_ProcessMessage informs the telnet server that the response is larger and needs more packets to send. The fourth parameter pvar can be used as a helper to process a large response message.
uint32_t netTELNETs_ProcessCommand (const char *cmd, char *buf, uint32_t buf_len, uint32_t *pvar) { uint32_t len = 0; if (*pvar == 0) { // First call to this function, process command cmd // len = Copy initial part of the response into the buf // *pvar = 1; // Set request for another callback return (len | (1u << 31)); } else { // A subsequent call to this function // len = Copy message fragment into the buf // *pvar++; if (!message_done) { // Set request for another callback return (len | (1u << 31)); } // This is the last fragment of the message return (len); } }
Hello,
Thanks for your answer.
I will try if I can send multiple buffers in my application