PHP Class Disque\Connection\Socket

Inheritance: extends Disque\Connection\BaseConnection, implements Disque\Connection\ConnectionInterface
Datei anzeigen Open project: mariano/disque-php

Protected Properties

Property Type Description
$socket resource Socket handle

Public Methods

Method Description
connect ( $connectionTimeout, $responseTimeout = null )
disconnect ( )
execute ( Disque\Command\CommandInterface $command )
isConnected ( )
receive ( boolean $keepWaiting = false ) : mixed Read data from connection
send ( string $data ) Execute a command on the connection

Protected Methods

Method Description
getSocket ( string $host, integer $port, float $timeout ) : resource Build actual socket

Private Methods

Method Description
getData ( ) : string Get a line of data
getType ( boolean $keepWaiting = false ) : string Get the first byte from Disque, which contains the data type
shouldBeConnected ( ) : void We should be connected

Method Details

connect() public method

public connect ( $connectionTimeout, $responseTimeout = null )

disconnect() public method

public disconnect ( )

execute() public method

public execute ( Disque\Command\CommandInterface $command )
$command Disque\Command\CommandInterface

getSocket() protected method

Build actual socket
protected getSocket ( string $host, integer $port, float $timeout ) : resource
$host string Host
$port integer Port
$timeout float Timeout
return resource Socket

isConnected() public method

public isConnected ( )

receive() public method

Read data from connection
public receive ( boolean $keepWaiting = false ) : mixed
$keepWaiting boolean If `true`, timeouts on stream read will be ignored
return mixed Data received

send() public method

Execute a command on the connection
public send ( string $data )
$data string Data to send

Property Details

$socket protected_oe property

Socket handle
protected resource $socket
return resource