Files
2025-12-22 14:34:25 +08:00

27 lines
1.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
return array(
//注释
'comment' => '
* 向客户端发送数据
*
* * $data发送的数据。TCP协议最大不得超过2MUDP协议不得超过64K
* * 发送成功会返回true如果连接已被关闭或发送失败会返回false
*
* TCP服务器
* -------------------------------------------------------------------------
* * send操作具有原子性多个进程同时调用send向同一个连接发送数据不会发生数据混杂
* * 如果要发送超过2M的数据可以将数据写入临时文件然后通过sendfile接口进行发送
*
* swoole-1.6以上版本不需要$from_id
*
* UDP服务器
* ------------------------------------------------------------------------
* * send操作会直接在worker进程内发送数据包不会再经过主进程转发
* * 使用fd保存客户端IPfrom_id保存from_fd和port
* * 如果在onReceive后立即向客户端发送数据可以不传$reactor_id
* * 如果向其他UDP客户端发送数据必须要传入$reactor_id
* * 在外网服务中发送超过64K的数据会分成多个传输单元进行发送如果其中一个单元丢包会导致整个包被丢弃。所以外网服务建议发送1.5K以下的数据包
*',
//返回值
'return' => 'bool'
);