Пример #1
0
 /**
  * @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();
 }
Пример #2
0
 /**
  * @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();
 }