PHP Class PHPDaemon\Network\Connection

Author: Vasily Zorin ([email protected])
Inheritance: extends IOStream
Datei anzeigen Open project: kakserpom/phpdaemon Class Usage Examples

Protected Properties

Property Type Description
$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?

Public Methods

Method Description
__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

Protected Methods

Method Description
importParams ( )
initSSLContext ( ) : object | false Initialize SSL context

Method Details

__destruct() public method

Destructor
public __destruct ( ) : void
return void

__get() public method

Getter
public __get ( string $name ) : mixed
$name string Name
return mixed

close() public method

Close the connection
public close ( ) : void
return void

connect() public method

Connects to URL
public connect ( string $url, callable $cb = null ) : boolean
$url string URL
$cb callable Callback
return boolean Success

connectRaw() public method

Establish raw socket connection
public connectRaw ( string $host ) : boolean
$host string Hostname
return boolean Success

connectTcp() public method

Establish TCP connection
public connectTcp ( string $host, integer $port ) : boolean
$host string Hostname
$port integer Port
return boolean Success

connectUdp() public method

Establish UDP connection
public connectUdp ( string $host, integer $port ) : boolean
$host string Hostname
$port integer Port
return boolean Success

connectUnix() public method

Establish UNIX socket connection
public connectUnix ( string $path ) : boolean
$path string Path
return boolean Success

getHost() public method

Get host
public getHost ( ) : string
return string

getPort() public method

Get port
public getPort ( ) : integer
return integer

getSocketName() public method

Get socket name
public getSocketName ( &$addr, &$port ) : void
return void

getUrl() public method

Get URL
public getUrl ( ) : string
return string

importParams() protected method

protected importParams ( )

initSSLContext() protected method

Initialize SSL context
protected initSSLContext ( ) : object | false
return object | false Context

isConnected() public method

Connected?
public isConnected ( ) : boolean
return boolean

onConnected() public method

Executes the given callback when/if the connection is handshaked
public onConnected ( callable $cb ) : void
$cb callable Callback
return void

onFailure() public method

Called when the connection failed to be established
public onFailure ( ) : void
return void

onFailureEv() public method

Called when the connection failed
public onFailureEv ( EventBufferEvent $bev = null ) : void
$bev EventBufferEvent
return void

onFinish() public method

Called when connection finishes
public onFinish ( ) : void
return void

onInheritanceFromRequest() public method

Called if we inherit connection from request
public onInheritanceFromRequest ( Request $req ) : void
$req Request Parent Request
return void

onReady() public method

Called when the connection is handshaked (at low-level), and peer is ready to recv. data
public onReady ( ) : void
return void

onUdpPacket() public method

Called when new UDP packet received
public onUdpPacket ( object $pct ) : void
$pct object Packet
return void

setDgram() public method

Sets DGRAM mode
public setDgram ( boolean $bool ) : void
$bool boolean DGRAM Mode
return void

setKeepalive() public method

Set keepalive
public setKeepalive ( boolean $bool ) : void
$bool boolean
return void

setOption() public method

Set socket option
public setOption ( integer $level, integer $optname, mixed $val ) : void
$level integer Level
$optname integer Option
$val mixed Value
return void

setParentSocket() public method

Sets parent socket
public setParentSocket ( Generic $sock ) : void
$sock PHPDaemon\BoundSocket\Generic
return void

setPeername() public method

Sets peer name
public setPeername ( string $host, integer $port ) : void
$host string Hostname
$port integer Port
return void

setTimeouts() public method

Set timeouts
public setTimeouts ( integer $read, integer $write ) : void
$read integer Read timeout in seconds
$write integer Write timeout in seconds
return void

write() public method

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
return boolean Success

Property Details

$addr protected_oe property

Address
protected $addr

$allowselfsigned protected_oe property

Allow self-signed?
protected $allowselfsigned

$bevConnectEnabled protected_oe property

Enable bevConnect?
protected $bevConnectEnabled

$certfile protected_oe property

Certificate file
protected $certfile

$connected protected_oe property

Connected?
protected $connected

$contextCache protected_oe static_oe property

Context cache
protected static $contextCache

$contextCacheSize protected_oe static_oe property

Context cache size
protected static $contextCacheSize

$dgram protected_oe property

Dgram connection?
protected $dgram

$failed protected_oe property

Failed?
protected $failed

$host protected_oe property

Hostname
protected $host

$hostReal protected_oe property

Real host
protected $hostReal

$keepalive protected_oe property

Keepalive?
protected $keepalive

$locAddr protected_oe property

Local address
protected $locAddr

$locPort protected_oe property

Local port
protected $locPort

$onConnected protected_oe property

Stack of callbacks called when connection is established
protected $onConnected

$parentSocket protected_oe property

Parent socket
protected $parentSocket

$passphrase protected_oe property

Passphrase
protected $passphrase

$password protected_oe property

Password
protected $password

$path protected_oe property

Path
protected $path

$pkfile protected_oe property

Private key file
protected $pkfile

$port protected_oe property

Port number
protected $port

$scheme protected_oe property

Scheme
protected $scheme

$timeout protected_oe property

Timeout
protected $timeout

$type protected_oe property

Type
protected $type

$uri protected_oe property

URI information
protected $uri

$user protected_oe property

User name
protected $user

$verifypeer protected_oe property

Verify peer?
protected $verifypeer