complez
complez

Reputation: 8332

how break the 64 limit when using WSAEventSelect

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

Upvotes: 1

Views: 683

Answers (4)

Jorge
Jorge

Reputation: 1

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!!

Upvotes: 0

Ritsaert Hornstra
Ritsaert Hornstra

Reputation: 5111

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.

Upvotes: 0

MSalters
MSalters

Reputation: 179917

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

Upvotes: 0

Mark Wilkins
Mark Wilkins

Reputation: 41222

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.

Upvotes: 3

Related Questions