PHP Class PHPDaemon\BoundSocket\UDP

Author: Vasily Zorin ([email protected])
Inheritance: extends Generic
显示文件 Open project: kakserpom/phpdaemon

Protected Properties

Property Type Description
$defaultPort integer Default port
$host string Hostname
$listenerMode boolean Listener mode?
$port integer Port
$portsMap Ports map
$reuse boolean Reuse?

Public Methods

Method Description
bindSocket ( ) : boolean Bind given addreess
enable ( ) : void Enable socket events
onReadUdp ( resource $stream = null, integer $events, mixed $arg = null ) : boolean Called when we got UDP packet
sendTo ( string $data, integer $flags, string $host, integer $port ) : integer Send UDP packet
setDefaultPort ( integer $port ) : void Sets default port
setReuse ( integer $reuse = true ) : void Sets reuse
unassignAddr ( string $addr ) : void Unassigns addr

Protected Methods

Method Description
onBound ( ) : boolean Called when socket is bound

Method Details

bindSocket() public method

Bind given addreess
public bindSocket ( ) : boolean
return boolean Success.

enable() public method

Enable socket events
public enable ( ) : void
return void

onBound() protected method

Called when socket is bound
protected onBound ( ) : boolean
return boolean Success

onReadUdp() public method

Called when we got UDP packet
public onReadUdp ( resource $stream = null, integer $events, mixed $arg = null ) : boolean
$stream resource Descriptor
$events integer Events
$arg mixed Attached variable
return boolean Success.

sendTo() public method

Send UDP packet
public sendTo ( string $data, integer $flags, string $host, integer $port ) : integer
$data string Data
$flags integer Flags
$host string Host
$port integer Port
return integer

setDefaultPort() public method

Sets default port
public setDefaultPort ( integer $port ) : void
$port integer Port
return void

setReuse() public method

Sets reuse
public setReuse ( integer $reuse = true ) : void
$reuse integer Port
return void

unassignAddr() public method

Unassigns addr
public unassignAddr ( string $addr ) : void
$addr string Address
return void

Property Details

$defaultPort protected_oe property

Default port
protected int $defaultPort
return integer

$host protected_oe property

Hostname
protected string $host
return string

$listenerMode protected_oe property

Listener mode?
protected bool $listenerMode
return boolean

$port protected_oe property

Port
protected int $port
return integer

$portsMap protected_oe property

Ports map
protected $portsMap

$reuse protected_oe property

Reuse?
protected bool $reuse
return boolean