- Method sendfile
lenbytes starting at
offsetfrom the file
trailersto the file
to. When completed
callbackwill be called with the total number of bytes sent as the first argument, followed by
trailersmay be left out by setting them to
-1means send from the current position in
-1means send until
from's end of file is reached.
The sending is performed asynchronously, and may complete both before and after the function returns.
callbackto be called, the backend must be active (ie
main()must have returned
-1, or Pike.DefaultBackend get called in some other way).
In some cases, the backend must also be active for any sending to be performed at all.
In Pike 7.4.496, Pike 7.6.120 and Pike 7.7 and later the backend associated with
towill be used rather than the default backend. Note that you usually will want
fromto have the same backend as
The low-level sending may be performed with blocking I/O calls, and thus trigger the process being killed with SIGPIPE when the peer closes the other end. Add a call to signal() to avoid this.
FIXME: Support for timeouts?
- See also