How to initialise a command line interface over TCP (using lwIP as the stack)

Hallo!
I want to create a command line interface (CLI) to operate on the target device. I want it to be accessible from the ethernet. I’m using the lwIP stack for the ethernet, and it works.

I generally understand how to CLI works (creating the command, registering it and so on), but I cannot find any information how to ‘bind’ the CLI to the Ethernet connection.
How can I make the CLI to recieve and send the output over TCP? (actually even UDP should be fine)

Suprisingly I cannot find any documentation covering this specific topic.

Thanks a lot for your answer!

It is always necessary to provide the actual input and output function when using the CLI as every board or chip is going to have multiple options. The FreeRTOS download contains generic examples for serial ports https://github.com/FreeRTOS/FreeRTOS/blob/V10.0.1/FreeRTOS-Plus/Demo/Common/FreeRTOS_Plus_CLI_Demos/UARTCommandConsole.c where you just have to provide the read and write functions like SerialPutString(), and you may be able to use UDP in those functions instead of serial. Alternatively here is an example using UDP, although with a now obsolete UDP stack: https://github.com/FreeRTOS/FreeRTOS/blob/V10.0.1/FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator/DemoTasks/UDPCommandServer.c

thanks for the links!
I have one more question though.
Basically it looks that I need to implement a regular TCP packet exchange, then read the recieved command into a buffer and call a FreeRTOS_CLIProcessCommand() with this buffer as a paramter.
Generally it is very similar to something that can be done with simple “switch { case }” behaviour of the regular C ( eg. case 1 : func1(); case 2: func2() and so on ).
What is than the purpose of the CLI in this case? What are the advantages? Or maybe I am missing some crucial part of the concept…

I managed to get the CLI working.
To put it simply : i used the tcpip stack to read the incoming message and used it as a cInputString for the FreeRTOS_CLIProcessCommand(). The same function writes a buffer that needs to be sent back to the remote machine.

I will also answer my other question: basically speaking CLI could be replaced with switch:case commands . However the great advantage of CLI is that it makes it much easier to write functions and is to be understood as a layer of abstraction that is very usefull and way easier to maintain. Furthermore it comes with few basic functions that make starting wiht i easier.