|
I am in a bit of a hurry at the moment so I will leave the code for later, right now I will just answer the main question.
If I understand the question correctly, you want to know why some of the components in the server are sometimes placed in the run method of the thread class.
The components of the server are written in the run method of the thread class so that when many different clients are connected to the server, the server can cater for each one of them by creating a separate thread for that particular client which ensures that even if multiple clients are requesting the same services, they can be served.
Hope this helps, will send the code example along with explanation later
|