Are SendAsync and ReceiveAsync using IO completion ports?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well, IO completion ports work by pending the completion routine as an APC to a worker thread in your ThreadPool (SocketAsyncEventArgsPool). So, the context is some worker thread that was created.
As to your actual question, I can’t imagine that they would use anything other than I/O completion ports, it would be very inefficient otherwise; however that is mostly an implementation detail – regardless of how they do it, the reality is that the notification is in an arbitrary context (i.e. you know nothing about what thread you’re in), so you need to do things in a thread-safe manner in your completion routine.
For good scalability, I would also try to minimize the work done in this routine, complete the I/O as fast as possible – if you have to do other work, use a separate thread pool that you can queue the real computation on.