I’m using the W5500 chip (Wiz850io module) configured as a TCP server that can accept multiple connections. I’d like each client to be able to send commands at the same time.
The command structure is: followed by carriage return. (\r)
Sometimes the commands can be sent over multiple packets so I’d like to buffer the data from each client until I receive the terminator (\r).
How can I do this?
I think the program should flow like this: (?)
- Detect new connection
- Create new buffer
- Receive data until \r is found.
- Process command
- Detect disconnect (if possible)
- Remove buffer
That means I need a way to identify new connections and unique clients so I can buffer their data separately.