PHP 클래스 Swoole\Client\TCP

상속: extends Swoole\Client\Base
파일 보기 프로젝트 열기: matyhtf/swoole_framework 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$connected
$try_reconnect 是否重新连接

공개 메소드들

메소드 설명
close ( ) 关闭socket连接
connect ( string $host, integer $port, float $timeout = 0.1, $nonblock = false ) : boolean 连接到服务器 接受一个浮点型数字作为超时,整数部分作为sec,小数部分*100万作为usec
isConnected ( ) : boolean 是否连接到服务器
recv ( integer $length = 65535, boolean $waitall = false ) : string | boolean 接收数据
send ( string $data ) : boolean | integer 发送数据

메소드 상세

close() 공개 메소드

关闭socket连接
public close ( )

connect() 공개 메소드

连接到服务器 接受一个浮点型数字作为超时,整数部分作为sec,小数部分*100万作为usec
public connect ( string $host, integer $port, float $timeout = 0.1, $nonblock = false ) : boolean
$host string 服务器地址
$port integer 服务器地址
$timeout float 超时默认值,连接,发送,接收都使用此设置
리턴 boolean

isConnected() 공개 메소드

是否连接到服务器
public isConnected ( ) : boolean
리턴 boolean

recv() 공개 메소드

接收数据
public recv ( integer $length = 65535, boolean $waitall = false ) : string | boolean
$length integer 接收数据的长度
$waitall boolean 等待接收到全部数据后再返回,注意这里超过包长度会阻塞住
리턴 string | boolean | bool

send() 공개 메소드

发送数据
public send ( string $data ) : boolean | integer
$data string
리턴 boolean | integer | int

프로퍼티 상세

$connected 공개적으로 프로퍼티

public $connected

$try_reconnect 공개적으로 프로퍼티

是否重新连接
public $try_reconnect