I would like to use the Overlapped IO functions in a .Net app, specifically WriteFileGather. Is this supported through the standard class library?
Bonus points: does it work in Mono?
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.
There is no direct function in .NET BCL, but there are some classes that can help you with Windows I/O.
1) Initialize an instance of Overlapped class.
2) Call Pack with the callback.
3) Pass the resulting NativeOverlapped (the return value of Pack) to the WriteFileGather.
4) As I understand, your callback should be called on a worker thread when the operation is complete.
Be sure to read MSDN docs on WriteFileGather as there are some requirements, e.g. the data must be aligned on the system’s page boundary (I think 4K on x86-x64, 8K on Itanium) etc. etc.