Hi all c# expers. Im developing a client server application.when the clients are connected to the server , i want them to be handled separately by server. I have the client connected() ,isdatareceived (), & other functions that perform file uploading for the client. I want to create threads when a client is connected to the server. and separately handle it. when a client is connected to the server, the server will check it's IP address & send update file by selecting it from a database.( IP is the primary key). server will take some other actions depending on the messages received from the clients olso.( updating databses, sending infomations). I m calling these methods in the isdatareceived (). the server is working perfectly , but it works only for single client at the moment.
how shold I create threads & whare should I create them. give me an example of creating multiple threads for connected clients.
Thank you.
Loading
Manoj BandgarPosted Jul 6, 2007, 9:36 AM
As soon as u receive the data create the object of the class and pass the received data to the class constructor from where the parsing,manipulation of data and saving to DB will take be taken care of in that specific class.
And your dedicated thread will wait for another datareceived event.
like this u can create any no of objects depending on ur system config.
And ur client will never be blocked.
In class procedure u have 2 take care so that each threads exits properly.