There is no F# async wrapper (in the PowerPack) for TcpListener.BeginAcceptTcpClient()/EndAcceptTcpClient(). How do I write my own wrapper around this so that I can use the let! and async keywords and run it in parallel?
+3
A:
Have you checked out the Async.BuildPrimitive
function? I think you can do something like:
type TcpListener with
member x.AsyncAcceptClient() =
Async.BuildPrimitive(x.BeginAcceptTcpClient, x.EndAcceptTcpClient)
to create an extension method returning an appropriate async result.
kvb
2009-09-23 16:44:53
Thanks, exactly what I was looking for
esac
2009-09-23 17:02:21