HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulesimple-sendfile-0.2.32Haskell2010

Network.Sendfile

Cross platform library for the sendfile system call. This library tries to call minimum system calls which are the bottleneck of web servers.

  • 1 type
  • 4 values
valuesendfile :: Socket -> FilePath -> FileRange -> IO () -> IO ()
#

Simple binding for sendfile() of Linux. Used system calls:

  • EntireFile -- open(), stat(), sendfile(), and close()

  • PartOfFile -- open(), sendfile(), and close()

If the size of the file is unknown when sending the entire file, specifying PartOfFile is much faster.

The fourth action argument is called when a file is sent as chunks. Chucking is inevitable if the socket is non-blocking (this is the default) and the file is large. The action is called after a chunk is sent and before waiting the socket to be ready for writing.

Simple binding for send() and sendfile() of Linux. Used system calls:

  • EntireFile -- send(), open(), stat(), sendfile(), and close()

  • PartOfFile -- send(), open(), sendfile(), and close()

The fifth header is sent with send() + the MSG_MORE flag. If the file is small enough, the header and the file is send in a single TCP packet.

If the size of the file is unknown when sending the entire file, specifying PartOfFile is much faster.

The fourth action argument is called when a file is sent as chunks. Chucking is inevitable if the socket is non-blocking (this is the default) and the file is large. The action is called after a chunk is sent and before waiting the socket to be ready for writing.

valuesendfileFd :: Socket -> Fd -> FileRange -> IO () -> IO ()
#

Simple binding for sendfile() of Linux. Used system calls:

  • EntireFile -- stat() and sendfile()

  • PartOfFile -- sendfile()

If the size of the file is unknown when sending the entire file, specifying PartOfFile is much faster.

The fourth action argument is called when a file is sent as chunks. Chucking is inevitable if the socket is non-blocking (this is the default) and the file is large. The action is called after a chunk is sent and before waiting the socket to be ready for writing.

valuesendfileFdWithHeader
  1. :: Socket
  2. -> Fd
  3. -> FileRange
  4. -> IO ()
  5. -> [ByteString]
  6. -> IO ()
#

Simple binding for send() and sendfile() of Linux. Used system calls:

  • EntireFile -- send(), stat() and sendfile()

  • PartOfFile -- send() and sendfile()

The fifth header is sent with send() + the MSG_MORE flag. If the file is small enough, the header and the file is send in a single TCP packet.

If the size of the file is unknown when sending the entire file, specifying PartOfFile is much faster.

The fourth action argument is called when a file is sent as chunks. Chucking is inevitable if the socket is non-blocking (this is the default) and the file is large. The action is called after a chunk is sent and before waiting the socket to be ready for writing.