namespace Org\Shipsimu\Hub\Helper\Connection;
// Import application-specific stuff
+use Org\Shipsimu\Hub\Container\Socket\StorableSocket;
use Org\Shipsimu\Hub\Factory\Fragmenter\FragmenterFactory;
use Org\Shipsimu\Hub\Factory\Handler\Network\NetworkPackageHandlerFactory;
use Org\Shipsimu\Hub\Factory\Network\NetworkPackageFactory;
use Org\Shipsimu\Hub\Network\Delivery\Deliverable;
use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
use Org\Shipsimu\Hub\Network\Package\Delivery\Fragment\Fragmentable;
+use Org\Shipsimu\Hub\Traits\Container\Socket\StorableSocketTrait;
use Org\Shipsimu\Hub\Traits\Fragmenter\FragmentableTrait;
// Import framework stuff
use FragmentableTrait;
use OutputStreamTrait;
use StateableTrait;
+ use StorableSocketTrait;
// Exception codes
const EXCEPTION_UNSUPPORTED_ERROR_HANDLER = 0x9100;
* @return $class Expanded class name
*/
private function getConnectionClassNameFromSocket () {
- // Get recipient address/port
+ // Default is none
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-CONNECTION-HELPER: CALLED!');
- $recipientAddress = $this->getSocketInstance()->getSocketRecipientAddress();
- $recipientPort = $this->getSocketInstance()->getSocketRecipientPort();
+ $recipientAddress = '0.0.0.0';
+ $recipientPort = 0;
+
+ // Is a socket instance set?
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CONNECTION-HELPER: socketInstance[]=%s', gettype($this->getSocketInstance())));
+ if ($this->getSocketInstance() instanceof StorableSocket) {
+ // Get recipient address/port
+ $recipientAddress = $this->getSocketInstance()->getSocketRecipientAddress();
+ $recipientPort = $this->getSocketInstance()->getSocketRecipientPort();
+ }
// Construct it
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-CONNECTION-HELPER: recipientAddress=%s,recipientPort=%d', $recipientAddress, $recipientPort));
use Org\Shipsimu\Hub\Factory\State\Peer\PeerStateFactory;
use Org\Shipsimu\Hub\Helper\Connection\BaseConnectionHelper;
use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
-use Org\Shipsimu\Hub\Traits\Container\Socket\StorableSocketTrait;
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
abstract class BaseIpV4ConnectionHelper extends BaseConnectionHelper {
// Load traits
use HandleableTrait;
- use StorableSocketTrait;
/**
* Name of used protocol