PHP 클래스 Network\Connection

Socket connection.
파일 보기 프로젝트 열기: prggmr/xpspl 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$error string Error encountered on the socket.
$error_str string Error encountered on the socket.

보호된 프로퍼티들

프로퍼티 타입 설명
$_read_attempted integer Read Attempts
$_read_buffer string | null Read Buffer
$_socket resource Socket that is connected.

공개 메소드들

메소드 설명
__construct ( resource $socket ) : void Constructs a new connection.
_read_buffer ( integer $length = XPSPL_SOCKET_READ_LENGTH, integer $flags = MSG_DONTWAIT ) : string Reads the given length of data from the socket into the read buffer.
disconnect ( ) : event\Disconnect Send the signal to disconnect this socket.
flush_read_buffer ( ) : void Flushes the read buffer.
get_address ( ) : string | null Returns the address of the socket.
get_resource ( ) : resource Returns the socket resource.
is_connected ( ) : boolean Returns if the socket is currently connected.
read ( $length = XPSPL_SOCKET_READ_LENGTH, $start ) : void Read data from the socket.
write ( string $string, integer $flags = null ) : integer | boolean Writes data to the socket.

보호된 메소드들

메소드 설명
_connect ( ) : void Establishes the socket connection.

메소드 상세

__construct() 공개 메소드

Constructs a new connection.
public __construct ( resource $socket ) : void
$socket resource Socket connection.
리턴 void

_connect() 보호된 메소드

Establishes the socket connection.
protected _connect ( ) : void
리턴 void

_read_buffer() 공개 메소드

Reads the given length of data from the socket into the read buffer.
public _read_buffer ( integer $length = XPSPL_SOCKET_READ_LENGTH, integer $flags = MSG_DONTWAIT ) : string
$length integer Maximum number of bytes to read in. Default = 2MB
$flags integer See php.net/socket_recv
리턴 string

disconnect() 공개 메소드

Send the signal to disconnect this socket.
public disconnect ( ) : event\Disconnect
리턴 event\Disconnect

flush_read_buffer() 공개 메소드

Flushes the read buffer.
public flush_read_buffer ( ) : void
리턴 void

get_address() 공개 메소드

Returns the address of the socket.
public get_address ( ) : string | null
리턴 string | null

get_resource() 공개 메소드

Returns the socket resource.
public get_resource ( ) : resource
리턴 resource

is_connected() 공개 메소드

Returns if the socket is currently connected.
public is_connected ( ) : boolean
리턴 boolean

read() 공개 메소드

Read data from the socket.
public read ( $length = XPSPL_SOCKET_READ_LENGTH, $start ) : void
리턴 void

write() 공개 메소드

Writes data to the socket.
public write ( string $string, integer $flags = null ) : integer | boolean
$string string String to send.
$flags integer Send flags - php.net/socket_send
리턴 integer | boolean Number of bytes written, False on error

프로퍼티 상세

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

Read Attempts
protected int $_read_attempted
리턴 integer

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

Read Buffer
protected string|null $_read_buffer
리턴 string | null

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

Socket that is connected.
protected resource $_socket
리턴 resource

$error 공개적으로 프로퍼티

Error encountered on the socket.
public string $error
리턴 string

$error_str 공개적으로 프로퍼티

Error encountered on the socket.
public string $error_str
리턴 string