/** * @param string $address Name server IP address to resolve queries. * @param int $port * @param \Icicle\Socket\Connector\Connector|null $connector */ public function __construct($address, $port = self::DEFAULT_PORT, SocketConnector $connector = null) { $this->address = $address; $this->port = $port; $this->messageFactory = new MessageFactory(); $this->questionFactory = new QuestionFactory(); $this->encoder = (new EncoderFactory())->create(); $this->decoder = (new DecoderFactory())->create(); $this->connector = $connector ?: Socket\connector(); }
/** * @param \Icicle\Dns\Resolver\Resolver|null $resolver * @param \Icicle\Socket\Connector\Connector|null $connector */ public function __construct(Resolver $resolver = null, SocketConnector $connector = null) { $this->resolver = $resolver ?: Dns\resolver(); $this->connector = $connector ?: Socket\connector(); }