*/
public static final function createSocketContainer ($socketResource, string $socketProtocol, DeliverablePackage $packageInstance, string $socketType) {
// Validate parameter
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-CONTAINER: socketResource[%s]=%s,socketProtocol=%s,packageInstance=%s,socketType=%s - CALLED!', gettype($socketResource), $socketResource, $socketProtocol, $packageInstance->__toString(), $socketType));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('SOCKET-CONTAINER: socketResource[%s]=%s,socketProtocol=%s,packageInstance=%s,socketType=%s - CALLED!', gettype($socketResource), $socketResource, $socketProtocol, $packageInstance->__toString(), $socketType));
if (!is_resource($socketResource)) {
// Throw exception
throw new InvalidArgumentException(sprintf('socketResource[]=%s is not valid', $socketResource));
self::$configEntries[sprintf('%s_socket_listen_backlog', $socketInstance->getSocketType())] = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry(sprintf('%s_socket_listen_backlog', $socketInstance->getSocketProtocol()));
// Return the prepared instance
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: socketInstance=%s - EXIT!', strtoupper($socketProtocol), $socketInstance->__toString()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: socketInstance=%s - EXIT!', strtoupper($socketProtocol), $socketInstance->__toString()));
return $socketInstance;
}
*/
public function ifAddressMatches (string $unl) {
// Is parameter valid?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: unl=%s - CALLED!', strtoupper($this->getSocketProtocol()), $unl));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: unl=%s - CALLED!', strtoupper($this->getSocketProtocol()), $unl));
if (empty($unl)) {
// Throw again
throw new InvalidArgumentException('Parameter "unl" is empty');
//* DEBUG-DIE: */ if ($this->getSocketType() == StorableSocket::CONNECTION_TYPE_INCOMING) { die(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE))); }
// So, does both match?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketType=%s,packageInstance->recipientUnl=%s', strtoupper($this->getSocketProtocol()), $this->getSocketType(), $packageInstance->getRecipientUnl()));
- //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: unl=' . $unl . ',packageInstance=' . print_r($packageInstance, true));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: this->socketType=%s,packageInstance->recipientUnl=%s', strtoupper($this->getSocketProtocol()), $this->getSocketType(), $packageInstance->getRecipientUnl()));
+ //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(strtoupper($this->getSocketProtocol()) . '-SOCKET: unl=' . $unl . ',packageInstance=' . print_r($packageInstance, true));
$matches = (!empty($packageInstance->getRecipientUnl()) && $packageInstance->getRecipientUnl() === $unl);
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: matches=%d - EXIT!', strtoupper($this->getSocketProtocol()), intval($matches)));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: matches=%d - EXIT!', strtoupper($this->getSocketProtocol()), intval($matches)));
return $matches;
}
*/
public function ifSocketResourceMatches ($socketResource) {
// So, does both match?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: socketResource[' . gettype($socketResource) . ']=' .$socketResource . ',storedResource[' . gettype($this->getSocketResource()) . ']=' . $this->getSocketResource());
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(strtoupper($this->getSocketProtocol()) . '-SOCKET: socketResource[' . gettype($socketResource) . ']=' .$socketResource . ',storedResource[' . gettype($this->getSocketResource()) . ']=' . $this->getSocketResource());
$matches = ((is_resource($socketResource)) && ($socketResource === $this->getSocketResource()));
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: matches=%d - EXIT!', strtoupper($this->getSocketProtocol()), intval($matches)));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: matches=%d - EXIT!', strtoupper($this->getSocketProtocol()), intval($matches)));
return $matches;
}
*/
public function shutdownSocket () {
// Debug message
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Shutting down socket ' . $this->getSocketResource() . ' with state ' . ($this->getHelperInstance() instanceof Helper ? $this->getHelperInstance()->getPrintableState() : 'NULL') . ' ...');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(strtoupper($this->getSocketProtocol()) . '-SOCKET: Shutting down socket ' . $this->getSocketResource() . ' with state ' . ($this->getHelperInstance() instanceof Helper ? $this->getHelperInstance()->getPrintableState() : 'NULL') . ' ...');
// Get a visitor instance
$visitorInstance = ObjectFactory::createObjectByConfiguredName('shutdown_socket_visitor_class');
// Debug output
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET:' . $this->__toString() . ': visitorInstance=' . $visitorInstance->__toString());
+ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(strtoupper($this->getSocketProtocol()) . '-SOCKET:' . $this->__toString() . ': visitorInstance=' . $visitorInstance->__toString());
// Call the visitor
$this->accept($visitorInstance);
// Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: EXIT!', strtoupper($this->getSocketProtocol())));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: EXIT!', strtoupper($this->getSocketProtocol())));
}
/**
*/
public function halfShutdownSocket () {
// Debug message
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Half-shutting down socket resource ' . $this->getSocketResource() . ' with state ' . $this->getHelperInstance()->getPrintableState() . ' ...');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(strtoupper($this->getSocketProtocol()) . '-SOCKET: Half-shutting down socket resource ' . $this->getSocketResource() . ' with state ' . $this->getHelperInstance()->getPrintableState() . ' ...');
// Get a visitor instance
$visitorInstance = ObjectFactory::createObjectByConfiguredName('half_shutdown_socket_visitor_class');
// Debug output
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET:' . $this->__toString() . ': visitorInstance=' . $visitorInstance->__toString());
+ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(strtoupper($this->getSocketProtocol()) . '-SOCKET:' . $this->__toString() . ': visitorInstance=' . $visitorInstance->__toString());
// Call the visitor
$this->accept($visitorInstance);
// Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: EXIT!', strtoupper($this->getSocketProtocol())));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: EXIT!', strtoupper($this->getSocketProtocol())));
}
/**
*/
public function accept (Visitor $visitorInstance) {
// Visit this listener
- /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - CALLED!');
+ /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(strtoupper($this->getSocketProtocol()) . '-SOCKET: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - CALLED!');
$visitorInstance->visitSocket($this);
// Trace message
- /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!');
+ /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(strtoupper($this->getSocketProtocol()) . '-SOCKET: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - EXIT!');
}
/**
*/
public function determineSocketPeerName (string &$peerAddress, int &$peerPort) {
// Should be valid socket
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: peerAddress[%s]=%s,peerPort[%s]=%d - CALLED!', strtoupper($this->getSocketProtocol()), gettype($peerAddress), $peerAddress, gettype($peerPort), $peerPort));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: peerAddress[%s]=%s,peerPort[%s]=%d - CALLED!', strtoupper($this->getSocketProtocol()), gettype($peerAddress), $peerAddress, gettype($peerPort), $peerPort));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
}
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: peerAddress=%s,peerPort=%d,result[%s]=%d - EXIT!', strtoupper($this->getSocketProtocol()), $peerAddress, $peerPort, gettype($result), intval($result)));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: peerAddress=%s,peerPort=%d,result[%s]=%d - EXIT!', strtoupper($this->getSocketProtocol()), $peerAddress, $peerPort, gettype($result), intval($result)));
return $result;
}
*/
public function getSocketRecipientUnl () {
// Should be valid socket
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$packageInstance = $this->getPackageDataInstance();
// Return it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: packageInstance.recipient=%s - EXIT!', strtoupper($this->getSocketProtocol()), $packageInstance->getRecipientUnl()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: packageInstance.recipient=%s - EXIT!', strtoupper($this->getSocketProtocol()), $packageInstance->getRecipientUnl()));
return $packageInstance->getRecipientUnl();
}
*/
public function getSocketRecipientAddress () {
// Should be valid socket
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$recipientUnl = $this->getSocketRecipientUnl();
// Generate UNL instance for it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: recipientUnl=%s', strtoupper($this->getSocketProtocol()), $recipientUnl));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: recipientUnl=%s', strtoupper($this->getSocketProtocol()), $recipientUnl));
$locatorInstance = UniversalNodeLocatorFactory::createUnlInstanceFromString($recipientUnl);
// Get address part
$recipientAddress = $locatorInstance->getUnlAddress();
// Return it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: recipientAddress=%s - EXIT!', strtoupper($this->getSocketProtocol()), $recipientAddress));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: recipientAddress=%s - EXIT!', strtoupper($this->getSocketProtocol()), $recipientAddress));
return $recipientAddress;
}
*/
public function getSocketRecipientPort () {
// Should be valid socket
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$recipientUnl = $this->getSocketRecipientUnl();
// Generate UNL instance for it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: recipientUnl=%s', strtoupper($this->getSocketProtocol()), $recipientUnl));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: recipientUnl=%s', strtoupper($this->getSocketProtocol()), $recipientUnl));
$locatorInstance = UniversalNodeLocatorFactory::createUnlInstanceFromString($recipientUnl);
// Get port part
$recipientPort = $locatorInstance->getUnlPort();
// Return it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: recipientPort=%d - EXIT!', strtoupper($this->getSocketProtocol()), intval($recipientPort)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: recipientPort=%d - EXIT!', strtoupper($this->getSocketProtocol()), intval($recipientPort)));
return $recipientPort;
}
*/
public function isValidSocket () {
// Is it valid?
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
// @TODO maybe add more checks? is_resource() is still to less
$isValidSocket = (is_resource($this->getSocketResource()));
// Return status
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: isValidSocket=%d - EXIT!', strtoupper($this->getSocketProtocol()), intval($isValidSocket)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: isValidSocket=%d - EXIT!', strtoupper($this->getSocketProtocol()), intval($isValidSocket)));
return $isValidSocket;
}
*/
public function getLastSocketErrorCode () {
// Should be valid socket
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$errorCode = socket_last_error($this->getSocketResource());
// Return it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: errorCode=%d - EXIT!', strtoupper($this->getSocketProtocol()), intval($errorCode)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: errorCode=%d - EXIT!', strtoupper($this->getSocketProtocol()), intval($errorCode)));
return $errorCode;
}
*/
public function getLastSocketErrorMessage () {
// Should be valid socket
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$errorMessage = socket_strerror($this->getLastSocketErrorCode());
// Return it
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: errorMessage=%s - EXIT!', strtoupper($this->getSocketProtocol()), $errorMessage));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: errorMessage=%s - EXIT!', strtoupper($this->getSocketProtocol()), $errorMessage));
return $errorMessage;
}
*/
public function translateLastSocketErrorCodeToName () {
// Get last error code
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$errorCode = $this->getLastSocketErrorCode();
// Call "translate" method
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: errorCode=%d', strtoupper($this->getSocketProtocol()), $errorCode));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: errorCode=%d', strtoupper($this->getSocketProtocol()), $errorCode));
$codeName = $this->translateSocketErrorCodeToName($errorCode);
// Return it
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: codeName=%s - EXIT!', strtoupper($this->getSocketProtocol()), $codeName));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: codeName=%s - EXIT!', strtoupper($this->getSocketProtocol()), $codeName));
return $codeName;
}
*/
public function bindSocketToFile () {
// Should be valid socket
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
}
// Try to bind it to
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: Binding socket to file %s ...', strtoupper($this->getSocketProtocol()), $this->getSocketFile()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: Binding socket to file %s ...', strtoupper($this->getSocketProtocol()), $this->getSocketFile()));
$result = socket_bind($this->getSocketResource(), $this->getSocketFile());
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
return $result;
}
*/
public function bindSocketToListener () {
// Should be valid socket
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$port = $this->getListenerInstance()->getListenPort();
// Try to bind it to
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: Binding socket to address %s:%d ...', strtoupper($this->getSocketProtocol()), $address, $port));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: Binding socket to address %s:%d ...', strtoupper($this->getSocketProtocol()), $address, $port));
$result = socket_bind($this->getSocketResource(), $address, $port);
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
return $result;
}
*/
public function listenToSocket () {
// Should be valid socket
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$result = socket_listen($this->getSocketResource(), self::$configEntries[sprintf('%s_socket_listen_backlog', $this->getSocketType())]);
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
return $result;
}
*/
public function enableSocketNonBlocking () {
// Should be valid socket
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$result = socket_set_nonblock($this->getSocketResource());
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
return $result;
}
*/
public function enableSocketReuseAddress () {
// Should be valid socket
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$result = $this->setSocketOption(SOL_SOCKET, SO_REUSEADDR, 1);
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
return $result;
}
*/
public function connectToSocketRecipient () {
// Should be valid socket
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$unlRecipient = $this->getSocketRecipientUnl();
// Create UNL instance from it. This will validate the connection
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: unlRecipient=%s', strtoupper($this->getSocketProtocol()), $unlRecipient));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: unlRecipient=%s', strtoupper($this->getSocketProtocol()), $unlRecipient));
$locatorInstance = UniversalNodeLocatorFactory::createUnlInstanceFromString($unlRecipient);
// Try to connect to it
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: unlAddress=%s,unlPort=%d', strtoupper($this->getSocketProtocol()), $locatorInstance->getUnlAddress(), $locatorInstance->getUnlPort()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: unlAddress=%s,unlPort=%d', strtoupper($this->getSocketProtocol()), $locatorInstance->getUnlAddress(), $locatorInstance->getUnlPort()));
$result = socket_connect($this->getSocketResource(), $locatorInstance->getUnlAddress(), $locatorInstance->getUnlPort());
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
return $result;
}
*/
public function doShutdown () {
// Should be valid socket
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new BadMethodCallException(sprintf('[%s:%d]: Shutdown on invalid socket. Maybe called already?', __METHOD__, __LINE__), self::EXCEPTION_INVALID_SOCKET, FrameworkInterface::EXCEPTION_BAD_METHOD_CALL);
}
// Debug message
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Shutting down socket ' . $this->getSocketResource());
+ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(strtoupper($this->getSocketProtocol()) . '-SOCKET: Shutting down socket ' . $this->getSocketResource());
DebugMiddleware::getSelfInstance()->partialStub('Please rewrite this method.');
return;
$this->markConnectionShuttedDown();
// Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: EXIT!', strtoupper($this->getSocketProtocol())));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: EXIT!', strtoupper($this->getSocketProtocol())));
}
/**
*/
public function isValidConnectionType (string $connectionType) {
// Validate parameter
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: connectionType=%d - CALLED!', strtoupper($this->getSocketProtocol()), $connectionType));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: connectionType=%d - CALLED!', strtoupper($this->getSocketProtocol()), $connectionType));
if (empty($connectionType)) {
// Throw exception
throw new InvalidArgumentException('connectionType is empty');
$isValid = in_array($connectionType, self::$connectionTypes, TRUE);
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: isValid=%d - EXIT!', strtoupper($this->getSocketProtocol()), intval($isValid)));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: isValid=%d - EXIT!', strtoupper($this->getSocketProtocol()), intval($isValid)));
return $isValid;
}
*/
public function acceptNewIncomingSocket () {
// Should be valid socket
- /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
}
// Init all arrays, at least readers
- /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: this->socketResource=%s', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$readers = [$this->getSocketResource()];
$writers = [];
$excepts = [];
// Check if we have some peers left
- /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: Invoking socket_select(%d,%d,%d,0%d) ...', strtoupper($this->getSocketProtocol()), count($readers), count($writers), count($excepts), self::$configEntries['socket_select_timeout']));
+ /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: Invoking socket_select(%d,%d,%d,0%d) ...', strtoupper($this->getSocketProtocol()), count($readers), count($writers), count($excepts), self::$configEntries['socket_select_timeout']));
$left = socket_select(
$readers,
$writers,
);
// Some new peers found?
- /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: left=%d,readers()=%d,writers()=%d,except()=%d) ...', strtoupper($this->getSocketProtocol()), $left, count($readers), count($writers), count($excepts)));
+ /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: left=%d,readers()=%d,writers()=%d,except()=%d) ...', strtoupper($this->getSocketProtocol()), $left, count($readers), count($writers), count($excepts)));
if ($left < 1) {
// Nothing new found
- /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: left=%d,serverSocket=%s,readers()=%d', strtoupper($this->getSocketProtocol()), $left, $this->getSocketResource(), count($readers)));
+ /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: left=%d,serverSocket=%s,readers()=%d, returning NULL - EXIT!', strtoupper($this->getSocketProtocol()), $left, $this->getSocketResource(), count($readers)));
return NULL;
} elseif (!in_array($this->getSocketResource(), $readers)) {
// Abort here
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: No incoming socket found, returning NULL - EXIT!', strtoupper($this->getSocketProtocol())));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: No incoming socket found, returning NULL - EXIT!', strtoupper($this->getSocketProtocol())));
return NULL;
}
$socketResource = socket_accept($this->getSocketResource());
// Create socket instance from it
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s,serverSocket=%s', strtoupper($this->getSocketProtocol()), $socketResource, $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: this->socketResource=%s,serverSocket=%s', strtoupper($this->getSocketProtocol()), $socketResource, $this->getSocketResource()));
$socketInstance = SocketFactory::createIncomingSocketInstance($socketResource, $this->getSocketProtocol());
// Return accepted socket instance
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: socketInstance=%s - EXIT!', strtoupper($this->getSocketProtocol()), $socketInstance->__toString()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: socketInstance=%s - EXIT!', strtoupper($this->getSocketProtocol()), $socketInstance->__toString()));
return $socketInstance;
}
*/
public function readDataFromSocket () {
// Should be valid socket
- /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$rawData = socket_read($this->getSocketResource(), FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('tcp_buffer_length'), PHP_BINARY_READ);
// Return it
- /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s,rawData[%s]=%s - EXIT!', strtoupper($this->getSocketProtocol()), $this->getSocketResource(), gettype($rawData), $rawData));
+ /* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s,rawData[%s]=%s - EXIT!', strtoupper($this->getSocketProtocol()), $this->getSocketResource(), gettype($rawData), $rawData));
return $rawData;
}
*/
public function identifySocketPeer () {
// Init peer address (IP)/port
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$peerAddress = '0.0.0.0';
$peerPort = 0;
$result = $this->determineSocketPeerName($peerAddress, $peerPort);
// Valid?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result=%d,peerAddress[%s]=%s,peerPort[%s]=%d', strtoupper($this->getSocketProtocol()), intval($result), gettype($peerAddress), $peerAddress, gettype($peerPort), $peerPort));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: result=%d,peerAddress[%s]=%s,peerPort[%s]=%d', strtoupper($this->getSocketProtocol()), intval($result), gettype($peerAddress), $peerAddress, gettype($peerPort), $peerPort));
if ($result === TRUE) {
// Set both
$this->setPeerAddress($peerAddress);
}
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
return $result;
}
*/
public function setSocketTimeoutOptions () {
// Call setter method with configured values
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$result = $this->setSocketOption(SOL_SOCKET, SO_RCVTIMEO, [
// Seconds
'sec' => FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($this->getSocketProtocol() . '_socket_accept_wait_sec'),
]);
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
return $result;
}
*/
public function enableSocketOutOfBandData () {
// Call inner method
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$result = $this->setSocketOption(SOL_SOCKET, SO_OOBINLINE, 1);
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
return $result;
}
*/
public function clearLastSocketError () {
// Should be valid socket
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: Clearing socket error, this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: Clearing socket error, this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
socket_clear_error($this->getSocketResource());
// Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: Error cleared - EXIT!', strtoupper($this->getSocketProtocol())));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: Error cleared - EXIT!', strtoupper($this->getSocketProtocol())));
}
/**
*/
public function registerInfoInstance (ShareableInfo $infoInstance) {
// Get listener/helper from info class
- /* NOSY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: infoInstance=%s,this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $infoInstance->__toString(), $this->getSocketResource()));
+ /* NOSY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: infoInstance=%s,this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $infoInstance->__toString(), $this->getSocketResource()));
$listenerInstance = $infoInstance->getListenerInstance();
$helperInstance = $infoInstance->getHelperInstance();
// Is there a listener or a connection helper instance set?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: listenerInstance[]=%s,helperInstance[]=%s', strtoupper($this->getSocketProtocol()), gettype($listenerInstance), gettype($helperInstance)));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: listenerInstance[]=%s,helperInstance[]=%s', strtoupper($this->getSocketProtocol()), gettype($listenerInstance), gettype($helperInstance)));
if ($listenerInstance instanceof Listenable) {
// Set it here for later usage
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Setting listenerInstance=' . $listenerInstance->__toString() . ' ...');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(strtoupper($this->getSocketProtocol()) . '-SOCKET: Setting listenerInstance=' . $listenerInstance->__toString() . ' ...');
$this->setListenerInstance($listenerInstance);
} elseif ($helperInstance instanceof ConnectionHelper) {
// Set it here for later usage
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Setting helperInstance=' . $helperInstance->__toString() . ' ...');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(strtoupper($this->getSocketProtocol()) . '-SOCKET: Setting helperInstance=' . $helperInstance->__toString() . ' ...');
$this->setHelperInstance($helperInstance);
}
// Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: EXIT!', strtoupper($this->getSocketProtocol())));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: EXIT!', strtoupper($this->getSocketProtocol())));
}
/**
*/
public function writeBufferToSocketByArray (array &$socketBuffer, &$sentBytes) {
// Should be valid socket
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: socketBuffer()=%d,sentBytes=%d - CALLED!', strtoupper($this->getSocketProtocol()), count($socketBuffer), $sentBytes));
- //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: socketBuffer=%s', strtoupper($this->getSocketProtocol()), print_r($socketBuffer, TRUE)));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: socketBuffer()=%d,sentBytes=%d - CALLED!', strtoupper($this->getSocketProtocol()), count($socketBuffer), $sentBytes));
+ //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: socketBuffer=%s', strtoupper($this->getSocketProtocol()), print_r($socketBuffer, TRUE)));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$bufferSize = $socketBuffer[NetworkPackageHandler::RAW_INDEX_BUFFER_SIZE];
// Is some data still pending or sent all out?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: bufferSize=%d,socketBuffer[%s]=%d', strtoupper($this->getSocketProtocol()), $bufferSize, NetworkPackageHandler::RAW_INDEX_DIFF, $socketBuffer[NetworkPackageHandler::RAW_INDEX_DIFF]));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: bufferSize=%d,socketBuffer[%s]=%d', strtoupper($this->getSocketProtocol()), $bufferSize, NetworkPackageHandler::RAW_INDEX_DIFF, $socketBuffer[NetworkPackageHandler::RAW_INDEX_DIFF]));
if ($socketBuffer[NetworkPackageHandler::RAW_INDEX_DIFF] >= 0) {
// Reduce buffer size by difference
$bufferSize = $socketBuffer[NetworkPackageHandler::RAW_INDEX_BUFFER_SIZE] - $socketBuffer[NetworkPackageHandler::RAW_INDEX_DIFF];
}
// Send buffered raw data
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: Invoking socket_write(%s,()=%d,%d) ...', strtoupper($this->getSocketProtocol()), $this->getSocketResource(), strlen($socketBuffer[NetworkPackageHandler::RAW_INDEX_ENCODED_DATA]), $bufferSize));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: Invoking socket_write(%s,()=%d,%d) ...', strtoupper($this->getSocketProtocol()), $this->getSocketResource(), strlen($socketBuffer[NetworkPackageHandler::RAW_INDEX_ENCODED_DATA]), $bufferSize));
$sentBytes = socket_write($this->getSocketResource(), $socketBuffer[NetworkPackageHandler::RAW_INDEX_ENCODED_DATA], $bufferSize);
// Check if the operation was okay
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: sentBytes[%s]=%d', strtoupper($this->getSocketProtocol()), gettype($sentBytes), $sentBytes));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: sentBytes[%s]=%d', strtoupper($this->getSocketProtocol()), gettype($sentBytes), $sentBytes));
// @TODO Maybe check more?
$result = ($sentBytes !== FALSE);
// If there was an error, don't continue here
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: sentBytes[%s]=%d,result=%d', strtoupper($this->getSocketProtocol()), gettype($sentBytes), $sentBytes, intval($result)));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: sentBytes[%s]=%d,result=%d', strtoupper($this->getSocketProtocol()), gettype($sentBytes), $sentBytes, intval($result)));
if ($result === FALSE) {
// Failed delivery!
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: socket_write() failed, please evaluate. - EXIT!', strtoupper($this->getSocketProtocol())));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: socket_write() failed, please evaluate. - EXIT!', strtoupper($this->getSocketProtocol())));
return FALSE;
} elseif (($sentBytes === 0) && (strlen($socketBuffer[NetworkPackageHandler::RAW_INDEX_ENCODED_DATA]) > 0)) {
// Nothing sent means all data has been sent
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: All sent, returning TRUE ... - EXIT!', strtoupper($this->getSocketProtocol())));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: All sent, returning TRUE ... - EXIT!', strtoupper($this->getSocketProtocol())));
return TRUE;
} else {
// The difference between sent bytes and length of raw data should not go below zero
$socketBuffer[NetworkPackageHandler::RAW_INDEX_SENT_BYTES] += $sentBytes;
// Cut out the last unsent bytes
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: Sent out %d of %d bytes ...', strtoupper($this->getSocketProtocol()), $sentBytes, strlen($socketBuffer[NetworkPackageHandler::RAW_INDEX_ENCODED_DATA])));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: Sent out %d of %d bytes ...', strtoupper($this->getSocketProtocol()), $sentBytes, strlen($socketBuffer[NetworkPackageHandler::RAW_INDEX_ENCODED_DATA])));
$socketBuffer[NetworkPackageHandler::RAW_INDEX_ENCODED_DATA] = substr($socketBuffer[NetworkPackageHandler::RAW_INDEX_ENCODED_DATA], $sentBytes);
// Calculate difference again
}
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
return $result;
}
*/
public function handleSocketError (string $method, int $line) {
// This method handles only socket resources
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: method=%s,line=%d,lastSocketErrorCode=%d - CALLED!', strtoupper($this->getSocketProtocol()), $method, $line, $this->getLastSocketErrorCode()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: method=%s,line=%d,lastSocketErrorCode=%d - CALLED!', strtoupper($this->getSocketProtocol()), $method, $line, $this->getLastSocketErrorCode()));
if (!$this->isValidSocket()) {
// No resource, abort here
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$handlerName = $this->getSocketErrorHandlerFromCode($errorCode);
// Call-back the error handler method
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: handlerName=%s', strtoupper($this->getSocketProtocol()), $handlerName));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('%s-SOCKET: handlerName=%s', strtoupper($this->getSocketProtocol()), $handlerName));
call_user_func_array([$this, $handlerName], []);
// Finally clear the error because it has been handled
$this->clearLastSocketError();
// Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: EXIT!', strtoupper($this->getSocketProtocol())));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: EXIT!', strtoupper($this->getSocketProtocol())));
}
/**
*/
protected function getSocketErrorHandlerFromCode (int $errorCode) {
// Create a name from translated error code
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: errorCode=%d - CALLED!', strtoupper($this->getSocketProtocol()), $errorCode));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: errorCode=%d - CALLED!', strtoupper($this->getSocketProtocol()), $errorCode));
$handlerName = 'handleSocketError' . StringUtils::convertToClassName($this->translateSocketErrorCodeToName($errorCode));
// Is the call-back method there?
}
// Return it
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: handlerName=%d - EXIT!', strtoupper($this->getSocketProtocol()), $handlerName));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: handlerName=%d - EXIT!', strtoupper($this->getSocketProtocol()), $handlerName));
return $handlerName;
}
*/
protected function handleSocketErrorPermissionDenied () {
// Get socket error code for verification
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$socketError = $this->getLastSocketErrorCode();
// Get error message
*/
protected function handleSocketErrorConnectionTimedOut () {
// Get socket error code for verification
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$socketError = $this->getLastSocketErrorCode();
// Get error message
*/
protected function handleSocketErrorResourceUnavailable () {
// Get socket error code for verification
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$socketError = $this->getLastSocketErrorCode();
// Get error message
*/
protected function handleSocketErrorConnectionRefused () {
// Get socket error code for verification
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$socketError = $this->getLastSocketErrorCode();
// Get error message
*/
protected function handleSocketErrorNoRouteToHost () {
// Get socket error code for verification
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$socketError = $this->getLastSocketErrorCode();
// Get error message
*/
protected function handleSocketErrorOperationAlreadyProgress () {
// Get socket error code for verification
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$socketError = $this->getLastSocketErrorCode();
// Get error message
*/
protected function handleSocketErrorConnectionResetByPeer () {
// Get socket error code for verification
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$socketError = $this->getLastSocketErrorCode();
// Get error message
*/
protected function handleSocketErrorOperationNotSupported () {
// Get socket error code for verification
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$socketError = $this->getLastSocketErrorCode();
// Get error message
*/
protected function handleSocketErrorOperationInProgress () {
// Very common with non-blocking I/O
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-HELPER: Operation is now in progress, this is usual for non-blocking connections and is no bug.');
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
+ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(strtoupper($this->getSocketProtocol()) . '-HELPER: Operation is now in progress, this is usual for non-blocking connections and is no bug.');
}
/************************************************************************
*/
private function translateSocketErrorCodeToName (int $errorCode) {
// Unknown error code by default
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: errorCode=%d - CALLED!', strtoupper($this->getSocketProtocol()), $errorCode));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: errorCode=%d - CALLED!', strtoupper($this->getSocketProtocol()), $errorCode));
$errorName = StorableSocket::SOCKET_ERROR_UNKNOWN;
// Is the code a number, then we have to change it
default: // Everything else <> 0
// Unhandled error code detected, so first debug it because we may want to handle it like the others
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf(strtoupper($this->getSocketProtocol()) . '-SOCKET: Unsupported errorCode=%d,message=%s', $errorCode, socket_strerror($errorCode)));
+ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf(strtoupper($this->getSocketProtocol()) . '-SOCKET: Unsupported errorCode=%d,message=%s', $errorCode, socket_strerror($errorCode)));
break;
}
// Return translated name
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: errorName=%s - EXIT!', strtoupper($this->getSocketProtocol()), $errorName));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: errorName=%s - EXIT!', strtoupper($this->getSocketProtocol()), $errorName));
return $errorName;
}
*/
private function setSocketOption (int $level, int $optionName, $optionValue) {
// Should be valid socket
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: level=%d,optionName=%d,optionValue[]=%s - CALLED!', strtoupper($this->getSocketProtocol()), $level, $optionName, gettype($optionValue)));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: level=%d,optionName=%d,optionValue[]=%s - CALLED!', strtoupper($this->getSocketProtocol()), $level, $optionName, gettype($optionValue)));
if (!$this->isValidSocket()) {
// Throw exception
throw new InvalidSocketException([$this], self::EXCEPTION_INVALID_SOCKET);
$result = socket_set_option($this->getSocketResource(), $level, $optionName, $optionValue);
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('%s-SOCKET: result[%s]=%d,errorCode=%s - EXIT!', strtoupper($this->getSocketProtocol()), gettype($result), intval($result), $this->getLastSocketErrorCode()));
return $result;
}