SimpleTest


SimpleTest\SimpleSocket
socket.php at line 74

Class SimpleSocket

SimpleStickyError
└─SimpleSocket

public class SimpleSocket
extends SimpleStickyError

Wrapper for TCP/IP socket.

Subpackage:
WebTester

Constructor Summary

SimpleSocket(string host, integer port, integer timeout)

Opens a socket for reading and writing.

Method Summary
boolean

close()

Closes the socket preventing further reads.

string

getSent()

Accessor for content so far.

boolean

isOpen()

Accessor for socket open state.

integer

read(integer block_size)

Reads data from the socket.

boolean

write(string message)

Writes some data to the socket and saves alocal copy.

Methods inherited from SimpleTest\SimpleStickyError
getError, isError

Constructor Detail

socket.php at line 86

SimpleSocket

public SimpleSocket(string host, integer port, integer timeout)

Opens a socket for reading and writing.

Parameters:
host - Hostname to send request to.
port - Port on remote machine to open.
timeout - Connection timeout in seconds.

Method Detail

socket.php at line 157

close

public boolean close()

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

Returns:
True if successful.

socket.php at line 167

getSent

public string getSent()

Accessor for content so far.

Returns:
Bytes sent only.

socket.php at line 147

isOpen

public boolean isOpen()

Accessor for socket open state.

Returns:
True if open.

socket.php at line 130

read

public integer read(integer block_size)

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

Parameters:
block_size - Size of chunk to read.
Returns:
Incoming bytes. False on error.

socket.php at line 104

write

public boolean write(string message)

Writes some data to the socket and saves alocal copy.

Parameters:
message - String to send to socket.
Returns:
True if successful.

SimpleTest