PHP WebSocket2 Library
PHP5 Library for browsing web
LowLevelSocket Class Reference

Socket based on PHP socket operations. More...

Inheritance diagram for LowLevelSocket:
NetworkSocket HttpSocket

Protected Member Functions

 open ($address, $port)
 
 setSecure ($secure, $host)
 
 isSecure ()
 
 isOpen ()
 
 writeRawPart ($request)
 
 read ($size)
 
 close ()
 
- Protected Member Functions inherited from NetworkSocket
 readLength ($length, $headers, WebRequest $request, &$aborted)
 
 readAll ($headers, WebRequest $request)
 
 setSecure ($secure, $host)
 Sets socket to secure mode or turns off secure mode. More...
 
 isSecure ()
 Returns true if socket is in secure mode. More...
 
 writeRawPart ($data)
 Writes part of raw data to socket. More...
 
 startTimeMeasurement ($socket_open=false)
 Starts time measurement for socket operation (read, write, connect, etc). More...
 
 checkPoint ()
 Stops time measurement for socket operation (read, write, connect, etc) and checks for timeout. More...
 
- Protected Member Functions inherited from HttpSocket
 open ($address, $port)
 Opens socket. More...
 
 read ($size)
 Reads raw data from socket. More...
 
 close ()
 Closes socket.
 
 isOpen ()
 Returns true if socket is open. More...
 
 readChunked ($headers, WebRequest $request)
 Reads chunked content from socket and puts chunks to single string. More...
 
 readLength ($length, $headers, WebRequest $request, &$aborted)
 Reads data with specified length from socket. If socket closes connection or no more data is available to reach length, throws WebRequestException. More...
 
 readAll ($headers, WebRequest $request)
 Reads all available data from socket until it closes connection. More...
 
 readUntil ($text)
 Reads all available data from socket until specified substring is found inside contents. More...
 
 readHeaders ()
 Reads response headers. More...
 
 write (WebRequest $request)
 Writes request to socket. More...
 

Additional Inherited Members

- Public Member Functions inherited from NetworkSocket
 setOnReceiveBodyCallback (callable $on_receive_body=null)
 Sets callback function that will be called when a part of response body is read from socket. More...
 
 getOnReceiveBodyCallback ()
 Returns callback function that will be called when a part of response body is read from socket. More...
 
 setOnReceiveHeadersCallback (callable $on_receive_headers=null)
 Sets callback function that will be called when response headers are read from socket. More...
 
 getOnReceiveHeadersCallback ()
 Returns callback function that will be called when response headers are read from socket. More...
 
 sendRequest (WebRequest $request)
 
 setTimeout ($timeout)
 Sets timeout in seconds for socket operations. More...
 
 getTimeout ()
 Returns timeout in seconds for socket operations. More...
 
 getAvailableTime ()
 Returns timeout in seconds for socket operations. More...
 
 setTimeoutMode ($timeout_mode)
 Sets timeout calculation mode for socket operations. More...
 
 getTimeoutMode ()
 Returns timeout calculation mode for socket operations. More...
 
 writeRaw ($data)
 
- Public Member Functions inherited from HttpSocket
 __destruct ()
 Destructor.
 
 sendRequest (WebRequest $request)
 Sends request to socket and returns response. More...
 
 writeRaw ($request)
 Writes raw data to socket. More...
 
- Data Fields inherited from NetworkSocket
const TIMEOUT_MODE_EVERY_OPERATION = 0
 Timeout calculation mode: check for timeout for each network operation independently. More...
 
const TIMEOUT_MODE_TOTAL = 1
 Timeout calculation mode: check for timeout for all network operations in total from open() call. More...
 
const TIMEOUT_MODE_SUM_OF_OPERATIONS = 2
 Timeout calculation mode: check for timeout for all network operations in total. More...
 
- Protected Attributes inherited from NetworkSocket
 $timeout = 30
 
 $timeout_mode = self::TIMEOUT_MODE_SUM_OF_OPERATIONS
 
 $start_time = 0
 
 $socket_open_time = 0
 
 $time_taken = 0
 

Detailed Description

Socket based on PHP socket operations.

Does not support secure mode, but is able to calculate accurate timeouts and break operation exactly at the moment when timeout occured

Examples:
timeouts.php.

The documentation for this class was generated from the following file: