Hello.
I'd like to report this bad approach on the TCP Server and to ask for some workaround ideas.
I have a system capable of having thousands of files that WILL be listed if a tcp client issues the list command. Naturally it takes long time to the file system find all the files, which is natural.
When the client calls list operation, the main_TcpNet() doesn't return until the whole operation is done. This freezes the system for more than 10 secs.
The Keil's TCP Server should be able to perform the list operation in parts, probably returning from the main_TcpNet after each file is found.
So, how can I workaround this? I still want to use ftp for file transfer, also, I can't use a RTOS, it is a bare metal firmware.
(I am using MDK 4.22)
But that 1% is going to be a bit of a bugger to close out. You have to change the whole paradigm quite significantly to refactor code that expects serialized linear flow into one that breaks it into multiple states/steps, and doesn't block. You'd also still need to recognize that resources are now still busy when performing all the other functions that are currently being blocked, and hope those in turn don't block.
I'd guess that puts you closer to 66%, which might be helpful as you consider your options moving forward.
I can't use a RTOS, since the firmware is 99% completed in a bare-metal fashion.
Here follows one workaround I've found: Run the main_TcpNet() at the main loop alone. And Run the rest of the system (which is at main today) at a low priority, high frequency interruption. That's one workaround but I want to consider other choices before implementing it.
Any other ideas?
If he doesn't have multiple threads/tasks then he'll need to turn the implementation on it's head and use a more state-full approach so it doesn't block.
TCP server approach is not bad; in fact it is very good for a lightweight system. It is your job to process the client request in manageable chuck sizes that do not hug the processor for too long.
You can't use an RTOS, or just choose not too?
View all questions in Keil forum