PHP 클래스 Workerman\Connection\TcpConnection

상속: extends Workerman\Connection\ConnectionInterface
파일 보기 프로젝트 열기: walkor/workerman 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$defaultMaxSendBufferSize integer Default send buffer size.
$id integer Connection->id.
$maxPackageSize integer Maximum acceptable packet size.
$maxSendBufferSize integer OnBufferFull callback will be emited When the send buffer is full.
$onBufferDrain callback Emitted when the send buffer becomes empty.
$onBufferFull callback Emitted when the send buffer becomes full.
$onClose callback Emitted when the other end of the socket sends a FIN packet.
$onError callback Emitted when an error occurs with connection.
$onMessage callback Emitted when data is received.
$protocol Workerman\Protocols\ProtocolInterface The format is like this Workerman\\Protocols\\Http.
$worker Workerman\Worker Which worker belong to.

보호된 프로퍼티들

프로퍼티 타입 설명
$_currentPackageLength integer Current package length.
$_id integer A copy of $worker->id which used to clean up the connection in worker->connections
$_idRecorder integer Id recorder.
$_isPaused boolean Is paused.
$_recvBuffer string Receive buffer.
$_remoteAddress string Remote address.
$_sendBuffer string Send buffer.
$_socket resource Socket
$_status integer Connection status.

공개 메소드들

메소드 설명
__construct ( resource $socket, string $remote_address = '' ) Construct.
__destruct ( ) : void Destruct.
baseRead ( resource $socket, boolean $check_eof = true ) : void Base read handler.
baseWrite ( ) : void | boolean Base write handler.
close ( mixed $data = null, boolean $raw = false ) : void Close connection.
consumeRecvBuffer ( integer $length ) : void Remove $length of data from receive buffer.
destroy ( ) : void Destroy connection.
getRemoteIp ( ) : string Get remote IP.
getRemotePort ( ) : integer Get remote port.
getSocket ( ) : resource Get the real socket.
pauseRecv ( ) : void Pauses the reading of data. That is onMessage will not be emitted. Useful to throttle back an upload.
pipe ( TcpConnection $dest ) : void This method pulls all the data out of a readable stream, and writes it to the supplied destination.
resumeRecv ( ) : void Resumes reading after a call to pauseRecv.
send ( string $send_buffer, boolean $raw = false ) : void | boolean | null Sends data on the connection.

보호된 메소드들

메소드 설명
bufferIsFull ( ) : boolean Whether send buffer is full.
checkBufferWillFull ( ) : void Check whether the send buffer will be full.

메소드 상세

__construct() 공개 메소드

Construct.
public __construct ( resource $socket, string $remote_address = '' )
$socket resource
$remote_address string

__destruct() 공개 메소드

Destruct.
public __destruct ( ) : void
리턴 void

baseRead() 공개 메소드

Base read handler.
public baseRead ( resource $socket, boolean $check_eof = true ) : void
$socket resource
$check_eof boolean
리턴 void

baseWrite() 공개 메소드

Base write handler.
public baseWrite ( ) : void | boolean
리턴 void | boolean

bufferIsFull() 보호된 메소드

Whether send buffer is full.
protected bufferIsFull ( ) : boolean
리턴 boolean

checkBufferWillFull() 보호된 메소드

Check whether the send buffer will be full.
protected checkBufferWillFull ( ) : void
리턴 void

close() 공개 메소드

Close connection.
public close ( mixed $data = null, boolean $raw = false ) : void
$data mixed
$raw boolean
리턴 void

consumeRecvBuffer() 공개 메소드

Remove $length of data from receive buffer.
public consumeRecvBuffer ( integer $length ) : void
$length integer
리턴 void

destroy() 공개 메소드

Destroy connection.
public destroy ( ) : void
리턴 void

getRemoteIp() 공개 메소드

Get remote IP.
public getRemoteIp ( ) : string
리턴 string

getRemotePort() 공개 메소드

Get remote port.
public getRemotePort ( ) : integer
리턴 integer

getSocket() 공개 메소드

Get the real socket.
public getSocket ( ) : resource
리턴 resource

pauseRecv() 공개 메소드

Pauses the reading of data. That is onMessage will not be emitted. Useful to throttle back an upload.
public pauseRecv ( ) : void
리턴 void

pipe() 공개 메소드

This method pulls all the data out of a readable stream, and writes it to the supplied destination.
public pipe ( TcpConnection $dest ) : void
$dest TcpConnection
리턴 void

resumeRecv() 공개 메소드

Resumes reading after a call to pauseRecv.
public resumeRecv ( ) : void
리턴 void

send() 공개 메소드

Sends data on the connection.
public send ( string $send_buffer, boolean $raw = false ) : void | boolean | null
$send_buffer string
$raw boolean
리턴 void | boolean | null

프로퍼티 상세

$_currentPackageLength 보호되어 있는 프로퍼티

Current package length.
protected int $_currentPackageLength
리턴 integer

$_id 보호되어 있는 프로퍼티

A copy of $worker->id which used to clean up the connection in worker->connections
protected int $_id
리턴 integer

$_idRecorder 보호되어 있는 정적으로 프로퍼티

Id recorder.
protected static int $_idRecorder
리턴 integer

$_isPaused 보호되어 있는 프로퍼티

Is paused.
protected bool $_isPaused
리턴 boolean

$_recvBuffer 보호되어 있는 프로퍼티

Receive buffer.
protected string $_recvBuffer
리턴 string

$_remoteAddress 보호되어 있는 프로퍼티

Remote address.
protected string $_remoteAddress
리턴 string

$_sendBuffer 보호되어 있는 프로퍼티

Send buffer.
protected string $_sendBuffer
리턴 string

$_socket 보호되어 있는 프로퍼티

Socket
protected resource $_socket
리턴 resource

$_status 보호되어 있는 프로퍼티

Connection status.
protected int $_status
리턴 integer

$defaultMaxSendBufferSize 공개적으로 정적으로 프로퍼티

Default send buffer size.
public static int $defaultMaxSendBufferSize
리턴 integer

$id 공개적으로 프로퍼티

Connection->id.
public int $id
리턴 integer

$maxPackageSize 공개적으로 정적으로 프로퍼티

Maximum acceptable packet size.
public static int $maxPackageSize
리턴 integer

$maxSendBufferSize 공개적으로 프로퍼티

OnBufferFull callback will be emited When the send buffer is full.
public int $maxSendBufferSize
리턴 integer

$onBufferDrain 공개적으로 프로퍼티

Emitted when the send buffer becomes empty.
public callback $onBufferDrain
리턴 callback

$onBufferFull 공개적으로 프로퍼티

Emitted when the send buffer becomes full.
public callback $onBufferFull
리턴 callback

$onClose 공개적으로 프로퍼티

Emitted when the other end of the socket sends a FIN packet.
public callback $onClose
리턴 callback

$onError 공개적으로 프로퍼티

Emitted when an error occurs with connection.
public callback $onError
리턴 callback

$onMessage 공개적으로 프로퍼티

Emitted when data is received.
public callback $onMessage
리턴 callback

$protocol 공개적으로 프로퍼티

The format is like this Workerman\\Protocols\\Http.
public ProtocolInterface,Workerman\Protocols $protocol
리턴 Workerman\Protocols\ProtocolInterface

$worker 공개적으로 프로퍼티

Which worker belong to.
public Worker,Workerman $worker
리턴 Workerman\Worker