threadpooling problem?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am programming a asyncronous server with .NET using ThreadPool..
Basicly Client connected to server using TCP sockets
When I test the program until 25 client server can respond all clients.but
after 25. client connected server cant respond other clients!where is the
problem?

when a client connected i want to check socket if data avaible..

ThreadPool.QueueUserWorkItem(new WaitCallback(CheckSocket),_socket);
.....
the CheckSocket callback:
private void CheckSocket(object state)
{
while(_connected)
{
if(_socket.Poll(-1, SelectMode.SelectRead))
{
if(_socket.Connected)
{
....
}
}
}
 
but when a thread must exit from threadpool?why a thread dont exists from
threadpool?thanks
 
A thread in the pool becomes free when a task is completed. However, in your
code,CheckSocket never returns - so no thread becomes free. If you're using
Whidbey, you have an option of increasing the maximum no. of threads to a
higher number
 
Back
Top