Class SimpleSocket

Description

Wrapper for TCP/IP socket.

Located in /socket.php (line 170)

SimpleStickyError
   |
   --SimpleSocket
Direct descendents
Class Description
 class SimpleSecureSocket Wrapper for TCP/IP socket over TLS.
Method Summary
 SimpleSocket __construct (string $host, integer $port, integer $timeout, [integer $block_size = 255])
 boolean close ()
 string getSent ()
 boolean isOpen ()
 void openSocket (string $host, integer $port,  &$error_number,  &$error, integer $timeout, integer $error_number, string $error)
 integer/boolean read ()
 boolean write (string $message)
Methods
Constructor __construct (line 184)

Opens a socket for reading and writing.

  • access: public
SimpleSocket __construct (string $host, integer $port, integer $timeout, [integer $block_size = 255])
  • string $host: Hostname to send request to.
  • integer $port: Port on remote machine to open.
  • integer $timeout: Connection timeout in seconds.
  • integer $block_size: Size of chunk to read.

Redefinition of:
SimpleStickyError::__construct()
Sets the error to empty.

Redefined in descendants as:
close (line 253)

Closes the socket preventing further reads.

Cannot be reopened once closed.

  • return: True if successful.
  • access: public
boolean close ()
getSent (line 263)

Accessor for content so far.

  • return: Bytes sent only.
  • access: public
string getSent ()
isOpen (line 243)

Accessor for socket open state.

  • return: True if open.
  • access: public
boolean isOpen ()
openSocket (line 276)

Actually opens the low level socket.

  • access: protected
void openSocket (string $host, integer $port,  &$error_number,  &$error, integer $timeout, integer $error_number, string $error)
  • string $host: Host to connect to.
  • integer $port: Port on host.
  • integer $error_number: Recipient of error code.
  • string $error: Recipoent of error message.
  • integer $timeout: Maximum time to wait for connection.
  • &$error_number
  • &$error

Redefined in descendants as:
read (line 226)

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

  • return: Incoming bytes. False on error.
  • access: public
integer/boolean read ()
write (line 201)

Writes some data to the socket and saves alocal copy.

  • return: True if successful.
  • access: public
boolean write (string $message)
  • string $message: String to send to socket.

Inherited Methods

Inherited From SimpleStickyError

 SimpleStickyError::__construct()
 SimpleStickyError::clearError()
 SimpleStickyError::getError()
 SimpleStickyError::isError()
 SimpleStickyError::setError()

Documentation generated on Sun, 31 Oct 2010 16:32:27 -0500 by phpDocumentor 1.4.3