//* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HTTP-CLIENT: rawRequest=' . $rawRequest);
// Write request
- fwrite($this->getSocketResource(), $rawRequest);
+ fwrite($this->getSocketInstance(), $rawRequest);
// Got response?
- if (feof($this->getSocketResource())) {
+ if (feof($this->getSocketInstance())) {
// No response received
return $response;
} // END - if
// Read the first line
- $resp = trim(fgets($this->getSocketResource(), 10240));
+ $resp = trim(fgets($this->getSocketInstance(), 10240));
// "Explode" the string to an array
$responseArray = explode(' ', $resp);
$encodedData = $this->getOutputStreamInstance()->streamData($rawData);
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: socketResource[]=' . gettype($this->getSocketResource()) . PHP_EOL);
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: socketResource[]=' . gettype($this->getSocketInstance()->getSocketResource()) . PHP_EOL);
// Init array
$encodedDataArray = array(
NetworkPackage::RAW_FINAL_HASH_INDEX => $this->currentFinalHash,
NetworkPackage::RAW_ENCODED_DATA_INDEX => $encodedData,
NetworkPackage::RAW_SENT_BYTES_INDEX => 0,
- NetworkPackage::RAW_SOCKET_INDEX => $this->getSocketResource(),
+ NetworkPackage::RAW_SOCKET_INDEX => $this->getSocketInstance(),
NetworkPackage::RAW_BUFFER_SIZE_INDEX => $bufferSize,
NetworkPackage::RAW_DIFF_INDEX => 0
);
protected function doListenSocketSelect ($peerSuffix) {
// Check on all instances
assert($this->getPoolInstance() instanceof Poolable);
- assert(is_resource($this->getSocketResource()));
+ assert($this->getSocketInstance()->isValidSocket());
// Get all readers
$readers = $this->getPoolInstance()->getAllSingleSockets();
$writers = array();
$excepts = array();
+ die('readers='.print_r($readers, TRUE));
// Check if we have some peers left
$left = socket_select(
// Some new peers found?
if ($left < 1) {
// Debug message
- //* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: left=' . $left . ',serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true));
+ //* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: left=' . $left . ',serverSocket=' . $this->getSocketInstance() . ',readers=' . print_r($readers, true));
// Nothing new found
return;
} // END - if
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: serverSocket=' . $this->getSocketResource() . ',readers=' . print_r($readers, true));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: serverSocket=' . $this->getSocketInstance() . ',readers=' . print_r($readers, true));
// Do we have changed peers?
- if (in_array($this->getSocketResource(), $readers)) {
+ if (in_array($this->getSocketInstance(), $readers)) {
/*
* Then accept it, if this socket is set to non-blocking IO and the
* connection is NOT sending any data, socket_read() may throw
* because if you have blocking IO socket_read() will wait and wait
* and wait ...
*/
- $newSocket = socket_accept($this->getSocketResource());
+ $newSocket = socket_accept($this->getSocketInstance());
// Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: newSocket=' . $newSocket . ',serverSocket=' .$this->getSocketResource());
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER: newSocket=' . $newSocket . ',serverSocket=' .$this->getSocketInstance());
// Array for timeout settings
$options = array(
*/
public function doListen() {
// Read a package and determine the peer
- $amount = @socket_recvfrom($this->getSocketResource(), $rawData, $this->getConfigInstance()->getConfigEntry('udp_buffer_length'), MSG_DONTWAIT, $peer, $port);
+ $amount = @socket_recvfrom($this->getSocketInstance(), $rawData, $this->getConfigInstance()->getConfigEntry('udp_buffer_length'), MSG_DONTWAIT, $peer, $port);
// Get last error
- $lastError = socket_last_error($this->getSocketResource());
+ $lastError = socket_last_error($this->getSocketInstance());
// Do we have an error at the line?
if ($lastError == 11) {
* "listener" won't read any packages except if the UDP sender
* starts the transmission before this "listener" came up...
*/
- socket_clear_error($this->getSocketResource());
+ socket_clear_error($this->getSocketInstance());
// Skip further processing
return;
-Subproject commit eb04c4ff13087f8e0ca96168e3d718761bedabdb
+Subproject commit 5301f9dd1ac83bc13ebfedda721477ec0405e228