HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulenetwork-3.2.8.0Haskell2010

Network.Socket.ByteString.Lazy

This module provides access to the BSD socket interface. For detailed documentation, consult your favorite POSIX socket reference. All functions communicate failures by converting the error number to an System.IO.Error.IOError.

This module is made to be imported with Network.Socket like so:

import Network.Socket
import Network.Socket.ByteString.Lazy
import Prelude hiding (getContents)
  • 5 values
  • Packagenetwork-3.2.8.0
  • Exports5
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceLazy.hs

Send data to a socket

3 declarations
valuesendWithFds
  1. :: Socket

    Socket

  2. -> ByteString

    Data to send

  3. -> [Fd]

    File descriptors

  4. -> IO ()
#

Send data and file descriptors over a UNIX-domain socket in a single system call. This function does not work on Windows.

Receive data from a socket

2 declarations
valuegetContents
  1. :: Socket

    Connected socket

  2. -> IO ByteString

    Data received

#

Receive data from the socket. The socket must be in a connected state. Data is received on demand, in chunks; each chunk will be sized to reflect the amount of data received by individual recv calls.

All remaining data from the socket is consumed. When there is no more data to be received, the receiving side of the socket is shut down. If there is an error and an exception is thrown, the socket is not shut down.

valuerecv
  1. :: Socket

    Connected socket

  2. -> Int64

    Maximum number of bytes to receive

  3. -> IO ByteString

    Data received

#

Receive data from the socket. The socket must be in a connected state. This function may return fewer bytes than specified. If the received data is longer than the specified length, it may be discarded depending on the type of socket. This function may block until a message arrives.

If there is no more data to be received, returns an empty ByteString.