simple-sendfile-0.2.25: Cross platform library for the sendfile system call

Safe HaskellNone
LanguageHaskell2010

Network.Sendfile

Description

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

Synopsis

Documentation

sendfile :: Socket -> FilePath -> FileRange -> IO () -> IO () Source #

Simple binding for sendfile() of BSD and MacOS.

  • Used system calls: open(), sendfile(), and close().

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 bofore waiting the socket to be ready for writing.

sendfileWithHeader :: Socket -> FilePath -> FileRange -> IO () -> [ByteString] -> IO () Source #

Simple binding for sendfile() of BSD and MacOS.

  • Used system calls: open(), sendfile(), and close().

The fifth header is also sent with sendfile(). If the file is small enough, the header and the file is send in a single TCP packet on FreeBSD. MacOS sends the header and the file separately but it is fast.

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 bofore waiting the socket to be ready for writing.

sendfileFd :: Socket -> Fd -> FileRange -> IO () -> IO () Source #

Simple binding for sendfile() of BSD and MacOS.

  • Used system calls: sendfile()

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 bofore waiting the socket to be ready for writing.

sendfileFdWithHeader :: Socket -> Fd -> FileRange -> IO () -> [ByteString] -> IO () Source #

Simple binding for sendfile() of BSD and MacOS.

  • Used system calls: sendfile()

The fifth header is also sent with sendfile(). If the file is small enough, the header and the file is send in a single TCP packet on FreeBSD. MacOS sends the header and the file separately but it is fast.

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 bofore waiting the socket to be ready for writing.

data FileRange Source #

File range for sendfile.