Update SocketClient to support UDP. Change DNS queries to use SocketClient
This commit is contained in:
@@ -138,14 +138,15 @@ final class SocketServer {
|
||||
|
||||
private function loop_udp()
|
||||
{
|
||||
$buf = '';
|
||||
$remote = [];
|
||||
$remote['ip'] = NULL;
|
||||
$remote['port'] = NULL;
|
||||
|
||||
while (TRUE) {
|
||||
if (socket_recvfrom($this->server,$buf,512,MSG_WAITALL,$remote['ip'],$remote['port']))
|
||||
$this->handler[0]->{$this->handler[1]}($remote,$buf,$this->server);
|
||||
$r = new SocketClient($this->server);
|
||||
|
||||
if ($r->hasData(30)) {
|
||||
$this->handler[0]->{$this->handler[1]}($r);
|
||||
|
||||
// Sleep so our thread has a chance to pick up the data from our connection
|
||||
usleep(50000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user