+
50
-

swoole tcp服务器与客户端如何发送大文件?

swoole tcp服务器与客户端如何发送大文件?


网友回复

+
0
-

服务端发送给tcp客户端

Swoole\Server->sendfile(int $fd, string $filename, int $offset = 0, int $length = 0): bool

客户端发送给服务端

Swoole\Client->sendfile(string $filename, int $offset = 0, int $length = 0): bool

int $offset功能:指定文件偏移量,可以从文件的某个位置起发送数据默认值:0 【默认为 0,表示从文件头部开始发送】其它值:无

int $length功能:指定发送的长度默认值:文件尺寸其它值:无

我知道答案,我要回答