> Hi
>
>    Does anybody have an example of using I/O completion ports in c#?.

The raw Win32 i/o completion port API (which you cite below) isn't
exposed directly in the CLR.  You'd have to use p/invoke to get to it.
I don't know off the top of my head where one is (because I don't know
anybody that's needed to do this, which is a clue), but you might try
searching www.gotdotnet.com and google.

>
> I know that asynchronous I/O is mapped to completion ports,
> but I think
> there's a more generic way using an API call
> (CreateIoCompletionPort() or
> GetQueuedCompletionStatus()).
>

Not sure what you mean by a "more generic way".  The two most common
reasons for using IOCPs in Win32 were to do asynchronous I/O and to
implement thread pools.  Both of those are already supported
intrinsically in the CLR via the async i/o capabilities of the Stream
classes (for I/O) and asynhchronous delegates and the ThreadPool class
(for thread pooling).

Assuming you find a sample of using p/invoke to get directly to the
Win32 api for IOCPs, what do you intend to use them for?  Maybe we can
point you to a different solution.

-Mike
DevelopMentor
http://staff.develop.com/woodring

Reply via email to