tags:

views:

82

answers:

4

i develop an echo server with WSAEventSelect. It only allow 64 connections. What should i do.

+2  A: 

That sounds suspiciously like the MAXIMUM_WAIT_OBJECTS limit, which is 64. The function WaitForMultipleObjectsEx is limited by that number. That link talks about solutions. If you are using WSAWaitForMultipleEvents, it might be this since the documentation says it calls WaitForForMultipleObjectsEx.

Mark Wilkins
A: 

Use more threads. Each thread can then handle 64 connections. It's quite possible to create 10-100 threads, depending on your hardware.

MSalters
A: 

There are 3 options:

  1. Use more threads with each the maximum # handles to wait for
  2. Use WSAAsyncSelect instead of WSAEventSelect and use Window messages instead
  3. Use overlapped IO (this is quite complex but scales best to large number of clients)

The limit is imposed by the Kernel that a thread can wait to a maximum of 64 kernel objects in one WaitFor function.

Ritsaert Hornstra
A: 

2.Use WSAAsyncSelect instead of WSAEventSelect and use Window messages instead

I would only go for WSAAsyncSelect in the client side for simple implementations, never for a server!!

Jorge