Moodle  2.2.1
http://www.collinsharper.com
SimpleSocket Class Reference
Inheritance diagram for SimpleSocket:
Collaboration diagram for SimpleSocket:

Public Member Functions

 SimpleSocket ($host, $port, $timeout, $block_size=255)
 write ($message)
 read ()
 isOpen ()
 close ()
 getSent ()
 _openSocket ($host, $port, &$error_number, &$error, $timeout)

Data Fields

 $_handle
 $_is_open = false
 $_sent = ''
 $lock_size

Detailed Description

Definition at line 74 of file socket.php.


Member Function Documentation

_openSocket ( host,
port,
&$  error_number,
&$  error,
timeout 
)

Actually opens the low level socket.

Parameters:
string$hostHost to connect to.
integer$portPort on host.
integer$error_numberRecipient of error code.
string$errorRecipoent of error message.
integer$timeoutMaximum time to wait for connection. protected

Reimplemented in SimpleSecureSocket.

Definition at line 180 of file socket.php.

Here is the caller graph for this function:

close ( )

Closes the socket preventing further reads. Cannot be reopened once closed.

Returns:
boolean True if successful. public

Definition at line 157 of file socket.php.

Here is the caller graph for this function:

getSent ( )

Accessor for content so far.

Returns:
string Bytes sent only. public

Definition at line 167 of file socket.php.

isOpen ( )

Accessor for socket open state.

Returns:
boolean True if open. public

Definition at line 147 of file socket.php.

Here is the caller graph for this function:

read ( )

Reads data from the socket. The error suppresion is a workaround for PHP4 always throwing a warning with a secure socket.

Returns:
integer/boolean Incoming bytes. False on error. public

Definition at line 130 of file socket.php.

Here is the call graph for this function:

SimpleSocket ( host,
port,
timeout,
block_size = 255 
)

Opens a socket for reading and writing.

Parameters:
string$hostHostname to send request to.
integer$portPort on remote machine to open.
integer$timeoutConnection timeout in seconds.
integer$block_sizeSize of chunk to read. public

Definition at line 88 of file socket.php.

Here is the call graph for this function:

Here is the caller graph for this function:

write ( message)

Writes some data to the socket and saves alocal copy.

Parameters:
string$messageString to send to socket.
Returns:
boolean True if successful. public

Definition at line 105 of file socket.php.

Here is the call graph for this function:


Field Documentation

$_handle

Definition at line 75 of file socket.php.

$_is_open = false

Definition at line 76 of file socket.php.

$_sent = ''

Definition at line 77 of file socket.php.

$lock_size

Definition at line 78 of file socket.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations