예제 #1
0
 function __construct(AsyncDNS $owner, Net_DNS_Packet $packet, $nextping = NULL)
 {
     parent::__construct($owner);
     $this->packet = $packet;
     if (!($sock = $this->connect(AsyncDNS::getNameservers()))) {
         throw new Exception("Nameservers down");
     }
     if (!$sock->send($packet->data())) {
         throw new Exception("Send error");
     }
     $sock->onRead(array($this, 'read'));
     $sock->onError(array($this, 'error'));
     $sock->onPing(array($this, 'ping'), $nextping);
     $this->sock = $sock;
 }