Need help with IO Completion ports...

  • Thread starter Thread starter Gordon Scott
  • Start date Start date
G

Gordon Scott

Hi there, Hopefully someone can point me to the correct newsgroup if this
one is incorrect.

I need some help with IO Completion ports.

I am trying to develop a streaming socket server than can handle 10K
simultaneous open sockets.
My first attempt was pretty vanilla C using ::select() on a large list of
sockets. I figured I could get
better performance out of IO Completion ports.

Everything seems to run fine for a few clients, once I reach around 500
clients, the call to CreateIoCompletionPort()
to accept a new client fails and returns an error code = 6.

I have no idea what the error code means. Is there some 512 limit for
sockets on an open completion port?
Any help would be great,

Thanks,
Gordon
(e-mail address removed)
 
Gordon Scott said:
Hi there, Hopefully someone can point me to the correct newsgroup if this
one is incorrect.

I need some help with IO Completion ports.

I am trying to develop a streaming socket server than can handle 10K
simultaneous open sockets.
My first attempt was pretty vanilla C using ::select() on a large list of
sockets. I figured I could get
better performance out of IO Completion ports.

Everything seems to run fine for a few clients, once I reach around 500
clients, the call to CreateIoCompletionPort()
to accept a new client fails and returns an error code = 6.

I have no idea what the error code means. Is there some 512 limit for
sockets on an open completion port?
Any help would be great,

Thanks,
Gordon
(e-mail address removed)

CICP returns NULL on failure. If GetLastError() returns '6', I think
it's 'invalid handle' - check with MSDN
 
I was freeing the HANDLE returned from CreateIOCompletion port, for an
individual socket when there was an error,
turns out that freeing that handle seemd to disrupt the entire IOCP. So
the '6' error code is fixed,

however I am still getting read/write errors when handling around 500
concurrent sockets. I'm hitting some kind of saturation point I think.
I'm going to try upping the number of IO threads in the creation of the
completion port to see if that helps. Should I be setting any particualar
socket options for this type of application? Right now I am setting only
TCP_NODELAY.
Would using non-blocking sockets with IOCP gain me anything? Perhaps my IO
threads are being bogged down by blocking sends?
 
Back
Top