[Haskell-cafe] Preferred way to get data from a socket

Chad Scherrer chad.scherrer at gmail.com
Tue Jun 26 16:13:09 EDT 2007

I've never used sockets before, but I need to now, and I need to be
able to get a lot of data quickly. I was thinking about doing
something like this (below), but I'm wondering if there's a way that
would be faster. Is the obvious way of doing this "the right way"? I'm
happy to install outside libraries if that would help, as long as they
work on Linux and MS. Thanks!



import Network
import qualified Data.ByteString.Lazy as B

hostName = "myComputer"
portID = PortNumber 54321

theData :: IO B.ByteString
theData = connectTo hostName portID >>= B.hGetContents

More information about the Haskell-Cafe mailing list