|
HI,
I have done a few IOCP Winsock application,
which work fine, but want to as a couple of things:
I have only designed using for TCP/IP protocol, and
for network, and internet access. I learned from the 'Network Programming Form
Microsoft Windows" book (second edition), and it explains the IOCP really well,
I have in the past read with interest some different comments, and wondering
what people thought of these?
The NumberOfConcurrentThread within the
CreateIOCompletionPort(..) indicates the number of threads allowed to execute
concurrently to avoid thread context switching, which seems logical to me. So
setting it to 0, will inform the processor to allow as many threads to run as
processors.
Now the worker threads depends on the type of
application. In my next application there will be database acess from users
connected to the server. So, It also mentions it is possible to have 'x' amount
of worker threads created, but only one will be accessed on the Completion port
at one time. But the handy part is that , which in my case, if database is
being accessed, then there is a chance that the worker thread be suspended doing
its thing with the database, and passing information to the client application.
In this case, another worker thread will be allowed to operate in its place,
which also sounds fair enough. So in my application, because of using databases,
I am thinking of creating say, 5-6 worker threads. Even though only one will
accessing the IOCP routine, another one can take over if it becomes busy with
database access. I am only planning to post one WSARecv(..) per socket handle,
so not much chance of receiving blocks at different times.
Also, I understand that Per I/O operation
structure, as it is only used for sending and receiving, but, when a connection
is established from a client, a WSARecv(..) is posted, which has to have a
pointer to a Per I/O structure. And within the IOCP routine, the pointer to this
buffer is returned with the data in it, then another WSARecv(..) is posted
within the worker thread. As I can see it, then while the socket connection is
live, each connectoin will alway have a Per I/O attatched to it. So if I have
500 connections, each one will have its own Per I/O structure , as it is passed
through the WSARecv(...). Is this correct??
Thanks for taking the time in reading through that,
but any opinions would be greatfull.
Regards
neil |
_______________________________________________ msvc mailing list [email protected] See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.
