0
Answer

NetworkStream deserialization in Threadpooling

serhat

serhat

16y
4.3k
1

Hi,

We are developing a multi user server client application. Thread per user would be inappropriate due to large number of possible client connections at a time so we are planning to use thread pooling instead.

I guess we will require a timeout value for network stream on recieve to prevent slow clients from creating a bottleneck for other clients. We are actually using network stream as stream parameter for deserialize method. However, timeout mechanism simply throws an exception if it cannot recieve data (and deserialize the object) in given time.

Question is, is there a way to implement this so that if timeout is expired, received portion of the serilized data will be kept in memory so that next time this connection is assigned from queue, deserialize method will simply start recieving data from the point it left on previous deserialize which failed due to timeout?

thanks in advance.

serhat