PHP Класс PHPDaemon\Network\Connection

Автор: Vasily Zorin ([email protected])
Наследование: extends IOStream
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$addr Address
$allowselfsigned Allow self-signed?
$bevConnectEnabled Enable bevConnect?
$certfile Certificate file
$connected Connected?
$contextCache Context cache
$contextCacheSize Context cache size
$dgram Dgram connection?
$failed Failed?
$host Hostname
$hostReal Real host
$keepalive Keepalive?
$locAddr Local address
$locPort Local port
$onConnected Stack of callbacks called when connection is established
$parentSocket Parent socket
$passphrase Passphrase
$password Password
$path Path
$pkfile Private key file
$port Port number
$scheme Scheme
$timeout Timeout
$type Type
$uri URI information
$user User name
$verifypeer Verify peer?

Открытые методы

Метод Описание
__destruct ( ) : void Destructor
__get ( string $name ) : mixed Getter
close ( ) : void Close the connection
connect ( string $url, callable $cb = null ) : boolean Connects to URL
connectRaw ( string $host ) : boolean Establish raw socket connection
connectTcp ( string $host, integer $port ) : boolean Establish TCP connection
connectUdp ( string $host, integer $port ) : boolean Establish UDP connection
connectUnix ( string $path ) : boolean Establish UNIX socket connection
getHost ( ) : string Get host
getPort ( ) : integer Get port
getSocketName ( &$addr, &$port ) : void Get socket name
getUrl ( ) : string Get URL
isConnected ( ) : boolean Connected?
onConnected ( callable $cb ) : void Executes the given callback when/if the connection is handshaked
onFailure ( ) : void Called when the connection failed to be established
onFailureEv ( EventBufferEvent $bev = null ) : void Called when the connection failed
onFinish ( ) : void Called when connection finishes
onInheritanceFromRequest ( Request $req ) : void Called if we inherit connection from request
onReady ( ) : void Called when the connection is handshaked (at low-level), and peer is ready to recv. data
onUdpPacket ( object $pct ) : void Called when new UDP packet received
setDgram ( boolean $bool ) : void Sets DGRAM mode
setKeepalive ( boolean $bool ) : void Set keepalive
setOption ( integer $level, integer $optname, mixed $val ) : void Set socket option
setParentSocket ( Generic $sock ) : void Sets parent socket
setPeername ( string $host, integer $port ) : void Sets peer name
setTimeouts ( integer $read, integer $write ) : void Set timeouts
write ( string $data ) : boolean Send data to the connection. Note that it just writes to buffer that flushes at every baseloop

Защищенные методы

Метод Описание
importParams ( )
initSSLContext ( ) : object | false Initialize SSL context

Описание методов

__destruct() публичный Метод

Destructor
public __destruct ( ) : void
Результат void

__get() публичный Метод

Getter
public __get ( string $name ) : mixed
$name string Name
Результат mixed

close() публичный Метод

Close the connection
public close ( ) : void
Результат void

connect() публичный Метод

Connects to URL
public connect ( string $url, callable $cb = null ) : boolean
$url string URL
$cb callable Callback
Результат boolean Success

connectRaw() публичный Метод

Establish raw socket connection
public connectRaw ( string $host ) : boolean
$host string Hostname
Результат boolean Success

connectTcp() публичный Метод

Establish TCP connection
public connectTcp ( string $host, integer $port ) : boolean
$host string Hostname
$port integer Port
Результат boolean Success

connectUdp() публичный Метод

Establish UDP connection
public connectUdp ( string $host, integer $port ) : boolean
$host string Hostname
$port integer Port
Результат boolean Success

connectUnix() публичный Метод

Establish UNIX socket connection
public connectUnix ( string $path ) : boolean
$path string Path
Результат boolean Success

getHost() публичный Метод

Get host
public getHost ( ) : string
Результат string

getPort() публичный Метод

Get port
public getPort ( ) : integer
Результат integer

getSocketName() публичный Метод

Get socket name
public getSocketName ( &$addr, &$port ) : void
Результат void

getUrl() публичный Метод

Get URL
public getUrl ( ) : string
Результат string

importParams() защищенный Метод

protected importParams ( )

initSSLContext() защищенный Метод

Initialize SSL context
protected initSSLContext ( ) : object | false
Результат object | false Context

isConnected() публичный Метод

Connected?
public isConnected ( ) : boolean
Результат boolean

onConnected() публичный Метод

Executes the given callback when/if the connection is handshaked
public onConnected ( callable $cb ) : void
$cb callable Callback
Результат void

onFailure() публичный Метод

Called when the connection failed to be established
public onFailure ( ) : void
Результат void

onFailureEv() публичный Метод

Called when the connection failed
public onFailureEv ( EventBufferEvent $bev = null ) : void
$bev EventBufferEvent
Результат void

onFinish() публичный Метод

Called when connection finishes
public onFinish ( ) : void
Результат void

onInheritanceFromRequest() публичный Метод

Called if we inherit connection from request
public onInheritanceFromRequest ( Request $req ) : void
$req Request Parent Request
Результат void

onReady() публичный Метод

Called when the connection is handshaked (at low-level), and peer is ready to recv. data
public onReady ( ) : void
Результат void

onUdpPacket() публичный Метод

Called when new UDP packet received
public onUdpPacket ( object $pct ) : void
$pct object Packet
Результат void

setDgram() публичный Метод

Sets DGRAM mode
public setDgram ( boolean $bool ) : void
$bool boolean DGRAM Mode
Результат void

setKeepalive() публичный Метод

Set keepalive
public setKeepalive ( boolean $bool ) : void
$bool boolean
Результат void

setOption() публичный Метод

Set socket option
public setOption ( integer $level, integer $optname, mixed $val ) : void
$level integer Level
$optname integer Option
$val mixed Value
Результат void

setParentSocket() публичный Метод

Sets parent socket
public setParentSocket ( Generic $sock ) : void
$sock PHPDaemon\BoundSocket\Generic
Результат void

setPeername() публичный Метод

Sets peer name
public setPeername ( string $host, integer $port ) : void
$host string Hostname
$port integer Port
Результат void

setTimeouts() публичный Метод

Set timeouts
public setTimeouts ( integer $read, integer $write ) : void
$read integer Read timeout in seconds
$write integer Write timeout in seconds
Результат void

write() публичный Метод

Send data to the connection. Note that it just writes to buffer that flushes at every baseloop
public write ( string $data ) : boolean
$data string Data to send
Результат boolean Success

Описание свойств

$addr защищенное свойство

Address
protected $addr

$allowselfsigned защищенное свойство

Allow self-signed?
protected $allowselfsigned

$bevConnectEnabled защищенное свойство

Enable bevConnect?
protected $bevConnectEnabled

$certfile защищенное свойство

Certificate file
protected $certfile

$connected защищенное свойство

Connected?
protected $connected

$contextCache защищенное статическое свойство

Context cache
protected static $contextCache

$contextCacheSize защищенное статическое свойство

Context cache size
protected static $contextCacheSize

$dgram защищенное свойство

Dgram connection?
protected $dgram

$failed защищенное свойство

Failed?
protected $failed

$host защищенное свойство

Hostname
protected $host

$hostReal защищенное свойство

Real host
protected $hostReal

$keepalive защищенное свойство

Keepalive?
protected $keepalive

$locAddr защищенное свойство

Local address
protected $locAddr

$locPort защищенное свойство

Local port
protected $locPort

$onConnected защищенное свойство

Stack of callbacks called when connection is established
protected $onConnected

$parentSocket защищенное свойство

Parent socket
protected $parentSocket

$passphrase защищенное свойство

Passphrase
protected $passphrase

$password защищенное свойство

Password
protected $password

$path защищенное свойство

Path
protected $path

$pkfile защищенное свойство

Private key file
protected $pkfile

$port защищенное свойство

Port number
protected $port

$scheme защищенное свойство

Scheme
protected $scheme

$timeout защищенное свойство

Timeout
protected $timeout

$type защищенное свойство

Type
protected $type

$uri защищенное свойство

URI information
protected $uri

$user защищенное свойство

User name
protected $user

$verifypeer защищенное свойство

Verify peer?
protected $verifypeer