[Top]
Stdio
|
Method Stdio.sendfile()
- Method
sendfile
-
object Stdio.sendfile(array(string) headers, object(File) from, int offset, int len, array(string) trailers, object(File) to)
object Stdio.sendfile(array(string) headers, object(File) from, int offset, int len, array(string) trailers, object(File) to, function(int:void) callback, mixed ... args)
- Description
-
Sends headers followed by len bytes starting at offset
from the file from followed by trailers to the file to.
When completed callback will be called with the total number of
bytes sent as the first argument, followed by args.
Any of headers, from and trailers may be left out
by setting them to 0.
Setting offset to -1 means send from the current position in
from.
Setting len to -1 means send until from's end of file is
reached.
- Note
-
The sending is performed asynchronously, and may complete
before the function returns.
For callback to be called, the backend must be active (ie
main() must have returned -1).
In some cases, the backend must also be active for any sending to
be performed at all.
- Bugs
-
FIXME: Support for timeouts?
- See also
-
Stdio.File.set_nonblocking
|