First of all, you need to handle the connection of each client in a non-blocking manner, you can see python socketserver.
In each connection, you need to read the buffer depending on the client-server logic:
- if your client disconnects after each data transfer, you can read the buffer in chunks until you get 0 length bytes, see recv
- if you happen to know the end of the client's message, you can read the buffer until you get that end bytes
- if you don't have any guess how client will send the data, you can check select.select or selectors