TCP Command Server - Can somebody review my (short) code on the playground?

I'm trying to create a 'TCP Command Server' that allows users (or more likely, applications) to connect and send commands to be processed. It is very similar to a Telnet server.

The requirement is to allow multiple users at the same time and place incoming data into buffers until we have a full command. (to allow commands send over multiple buffers, etc)

Here is my code:

Can anybody give it a review and let me know if you see any problems?

I've noticed there is already a Telnet server on the playground (, but I'm not sure why it appears to be more complicated and using the Wiznet driver directly. (There is probably a reason and that's why I'm asking what might be wrong with my code)

Does it compile? I'm not going to piece together 7 snippets to try to find out. You do it.

Does it work? If not, debug it. When you're stuck, ask for help but describe what the problem is and what you've done to try to find it.


I don't think you understood what I was asking. I wasn't asking you to compile my code for me.

The code works for me but I was asking for a peer review to see if anything looked wrong or incorrect.