!!      Safe.tsendfileAn iteratee for sendfileyIn general, a whole file is not sent by a single call to sendfile(), but a series of calls which send successive pieces.The high-level API in this sendfile library has calls which will send the entire file (or an entire requested offset+length), before returning.However, there are instances where you want to be a bit more involved in the sending loop. For example, if you want to tickle a timeout after each chunk is sent or update a progress bar.The  type gives you that power with out requiring you to manage all the low-level details of the sendfile loop. The interface is simple and consistant across all platforms.:A call to sendfile() can result in three different states: lthe requested number of bytes for that iteration was sent successfully, there are more bytes left to send.some (possibly 0) bytes were sent, but the file descriptor would now block if more bytes were written. There are more bytes left to send.;All the bytes were sent, and there is nothing left to send.EWe handle these three cases by using a type with three constructors: z data Iter = Sent Int64 (IO Iter) | WouldBlock Int64 Fd (IO Iter) | Done Int64 "All three constructors provide an !g which represents the number of bytes sent for that particular iteration. (Not the total byte count).The  and  constructors provide " T as their final argument. Running this IO action will send the next block of data.The  constructor also provides the #D for the output socket. You should not send anymore data until the #8 would not block. The easiest way to do that is to use $" to suspend the thread until the # is available.9A very simple function to drive the Iter might look like: runIter :: IO Iter -> IO () runIter iter = do r <- iter case r of (Done _n) -> return () (Sent _n cont) -> runIter cont (WouldBlock _n fd cont) -> do threadWaitWrite fd runIter cont DYou would use it as the first argument to a *IterWith function, e.g. = sendFileIterWith runIter outputSocket "/path/to/file" 2^16 The ^ function provided by this module is similar, but also returns the total number of bytes sent.NOTE: You must not use the # or the "  after the call to *IterWith has returned. When the *IterWith functions return, the file descriptors may be closed due to finalizers running.sendfile>number of bytes sent this pass and a continuation to send moresendfilenumber of bytes sent, Fd that blocked, continuation to send more. NOTE: The Fd should not be used outside the running of the Iter as it may be freed when the Iter is donesendfile%number of bytes sent, no more to sendsendfile_A simple function to drive the *IterWith functions. It returns the total number of bytes sent.Safe 9%sendfile&automatically loop and send everything&sendfilea way to send things in chunks'sendfilelow-level wrapper around sendfile non-blocking returns number of bytes written and whether the fd would block (aka, EAGAIN) does not call threadWaitWrite&sendfile/file descriptor corresponding to network socketsendfile%file descriptor corresponding to filesendfile'maximum number of bytes to send at oncesendfileoffset into filesendfiletotal number of bytes to send(sendfile/file descriptor corresponding to network socketsendfile%file descriptor corresponding to filesendfile'maximum number of bytes to send at oncesendfileoffset into filesendfiletotal number of bytes to send%&'Safe:)sendfile"wraps sendFile' to check arguments)NoneE *sendfileoutput network socketsendfile input handlesendfile'maximum number of bytes to send at oncesendfiletotal number of bytes to send+sendfile output handlesendfile input handlesendfile[maximum number of bytes to send at once -> Integer -- ^ offset into filesendfiletotal number of bytes to sendsendfileThe output handlesendfileThe input filepathsendfileThe offset to start atsendfileThe number of bytes to sendsendfileThe output handlesendfileThe input filepathsendfilemaximum block sizesendfileThe offset to start atsendfileThe number of bytes to send    None"#JR,sendfileThe output handlesendfileThe input filepathsendfileThe offset to start atsendfileThe number of bytes to send-sendfileThe output handlesendfileThe input filepathsendfilemaximum block sizesendfileThe offset to start atsendfileThe number of bytes to send ./0123456,-None} sendfile*The length (in bytes) which should be sentsendfile(The file offset (in bytes) to start fromsendfile1The simplest interface. Simply give it an output 7 and the 8 to the input file.sendfile1The simplest interface. Simply give it an output 7 and the 8 to the input file.?This variant takes a function to drive the iteration loop. See  for more information.sendfileQA more powerful interface than sendFile which accepts a starting offset, and the bytecount to send; the offset and the count must be a positive integer. The initial position of the input file handle matters not since the offset is absolute, and the final position may be different depending on the platform -- no assumptions can be made.sendfileQA more powerful interface than sendFile which accepts a starting offset, and the bytecount to send; the offset and the count must be a positive integer. The initial position of the input file handle matters not since the offset is absolute, and the final position may be different depending on the platform -- no assumptions can be made.?This variant takes a function to drive the iteration loop. See  for more information.sendfile/The unsafe version of sendFile which accepts a 9 instead of a 7O for the output. It will flush the output handle before sending any file data.sendfile/The unsafe version of sendFile which accepts a 9 instead of a 7O for the output. It will flush the output handle before sending any file data.?This variant takes a function to drive the iteration loop. See  for more information.sendfile0The unsafe version of sendFile' which accepts a 9 instead of a 7N for the output. It will flush the output handle before sending any file data.sendfile0The unsafe version of sendFile' which accepts a 9 instead of a 7N for the output. It will flush the output handle before sending any file data.?This variant takes a function to drive the iteration loop. See  for more information.sendfileaReturns the mode that sendfile was compiled with. Mainly for debugging use. Possible values are WIN32_SENDFILE, LINUX_SENDFILE, FREEBSD_SENDFILE, DARWIN_SENDFILE, and PORTABLE_SENDFILE. sendfileThe output socketsendfile%The path where the input file residessendfileThe output socketsendfile%The path where the input file residessendfile/Maximum bytes to send per block (may send less)sendfileThe output socketsendfileThe input file pathsendfileThe offset to start atsendfileThe number of bytes to sendsendfileThe output socketsendfileThe input file pathsendfile/Maximum bytes to send per block (may send less)sendfileThe offset to start atsendfileThe number of bytes to sendsendfileThe output handlesendfile%The path where the input file residessendfileThe output handlesendfile%The path where the input file residessendfile/Maximum bytes to send per block (may send less)sendfileThe output handlesendfileThe input filepathsendfileThe offset to start atsendfileThe number of bytes to sendsendfileThe output handlesendfileThe input filepathsendfileThe number of bytes to sendsendfileThe offset to start atsendfileThe number of bytes to sendsendfile(The mode that sendfile was compiled withNonecsendfilebSimple sendFile - give it a Socket and a Handle, and it sends the entire file through the socket."WARNING: This function will raise : IllegalOperation if the 9 is not for an Fd.sendfileA more interactive version of sendFile, which accepts a callback function in addition to the socket and handle. The callback will be called for each chunk of data the sendFileIterWith function acts on."WARNING: This function will raise : IllegalOperation if the 9 is not for an Fd.sendfile_A sendFile that allows the user to send a subset of the file associated with the given handle."WARNING: This function will raise : IllegalOperation if the 9 is not for an Fd. sendfileeA more powerful version of sendFileIterWith, which allows the sending of a subset of the given file."WARNING: This function will raise : IllegalOperation if the 9 is not for an Fd.   ;       !"#$%&'()*+, -./0123456&sendfile-0.7.10-Bn4W25B35tyLQPlIbCiJflNetwork.Socket.SendFile.Iter Network.Socket.SendFile.PortableNetwork.Socket.SendFileNetwork.Socket.SendFile.HandleNetwork.Socket.SendFile.LinuxNetwork.Socket.SendFile.Util Network.Socket.SendFile.InternalIterSent WouldBlockDonerunIter sendFileModesendFileIterWith'' sendFile''unsafeSendFileIterWith''unsafeSendFile''sendFilesendFileIterWith sendFile'sendFileIterWith'unsafeSendFileunsafeSendFileIterWithunsafeSendFile'unsafeSendFileIterWith' ByteCountOffsetbaseGHC.IntInt64ghc-prim GHC.TypesIOSystem.Posix.TypesFdControl.ConcurrentthreadWaitWrite _sendFile sendFileItersendfile sendFileIterI wrapSendFile' sendFileIterSunsafeSendFileIter&network-3.0.0.1-EUqtwEmuO02G908u1KOxQTNetwork.Socket.TypesSocketGHC.IOFilePathGHC.IO.Handle.TypesHandleGHC.IO.ExceptionIOError