ext-swooleis supported until v4.7.1, use
ext-openswoole>= v4.7.1. Latest version:
pecl install openswoole-4.9.1
<?php Swoole\Coroutine\Client->sendfile(string $filepath, int $offset = 0, int $length = 0): bool
The location of the file to send, only use an absolute file path.
Offset and start point for the given file, default is the beginning.
The length of the data to send, default is the whole file.
true when successful and
false when not.
Send file to the remote server connected socket.
This method is not supported when in UDP protocol mode.
Because you can change the offset and length of the file to send, this helps support resumable file transfers.
The client will return
false if the file does not exist and this method blocks until the entire file has been sent or if a fatal error occurs.
This is a wrapper of the Linux sendfile system call.