I have coded a single threaded client server model which does following:
- Server loops for client waiting..
- When client runs, it sends current data available (i.e. a string which has 10 fields seperated by comma)
- Server reads the data from client and decodes it (simply by checking for comma)
- Then using mybatis server updates database.
Now I want to convert this server to multithreaded one and I am really confused looking at some examples that I found while googling (i.e. chat server etc.).
So, can anyone please help me out where exactly to start from to convert server into a multithreaded one?
I can post the code here if required.
You could start a thread for every incoming connection.
At the bottom of this page you can find an example with source code: Writing the Server Side of a Socket