Ok, cool. FWIW, the current documentation for Network says:

"For really fast I/O, it might be worth looking at the hGetBuf and
hPutBuf family of functions in System.IO."

But this looked pretty low-level to me, and I figured it might be outdated.

I also know Bulat Ziganshin had put together a nice-looking Streams
library (http://unix.freshmeat.net/projects/streams/) based on John
Goerzen's previous HVIO work, but I wasn't sure if the ByteString
stuff matches the speed and encapsulates all of the functionality of
that anyway. Or can/should they be used together somehow?

Chad


> ----------------------8<-------------------------------
>
> import Network
> import qualified Data.ByteString.Lazy as B
>
> hostName = "myComputer"
> portID = PortNumber 54321
>
> theData :: IO B.ByteString
> theData = connectTo hostName portID >>= B.hGetContents
> _______________________________________________

Looks like the obvious, right way to me.

-- Don
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to