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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top