socket-0.6.0.0: An extensible socket library.

Copyright(c) Lars Petersen 2015
LicenseMIT
Maintainerinfo@lars-petersen.net
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

System.Socket.Type.Stream

Contents

Description

 

Synopsis

Stream

data Stream Source

Instances

Convenience Operations

sendAll, receiveAll

sendAll :: Socket f Stream p -> ByteString -> MessageFlags -> IO () Source

Like send, but operates on lazy ByteStrings and continues until all data has been sent or an exception occured.

receiveAll :: Socket f Stream p -> Int64 -> MessageFlags -> IO ByteString Source

Like receive, but operates on lazy ByteStrings and continues until either an empty part has been received (peer closed the connection) or given buffer limit has been exceeded or an exception occured.

  • The Int64 parameter is a soft limit on how many bytes to receive. Collection is stopped if the limit has been exceeded. The result might be up to one internal buffer size longer than the given limit. If the returned ByteStrings length is lower or eqal than the limit, the data has not been truncated and the transmission is complete.