ReceiveAsync each call to the asynchronous method will create a new thread?
If so is that every time receives the message asynchronously to create a single thread, so the number of threads will be too much?
CodePudding user response:
Strives for the bosses give an explanation, or under their own ideas can alsoCodePudding user response:
Threads are threads, asynchronous is asynchronous, don't mixThread is the level of CPU, asynchronous IO level is,
Thread as to what this kind of is not what you consider more things, because those threads are pending (waiting for the results and recovery) does not have what problem,
Such as ReceiveAsync is waiting for the network card driver to an IOCP complete signal, rather than you want to a CPU thread to run
CodePudding user response:
Borrow your post, of course, we can clarify that the threads and the relationship between the asynchronous (asynchronous IO operations, actually he is a semaphore control, rather than the thread control)Also need to clarify the IOCP, blog garden is prone to c # IOCP how, actually is wrong, the IOCP mechanism is done by Windows network card driver, not a complete c #, c # is a application side, not to implement party
CodePudding user response:
Code, to ask,,,, now doing a socket asynchronous callback...