public function __construct(\ThreadedLogger $logger, \ClassLoader $loader, $port, $interface = "127.0.0.1")
{
$this->logger = $logger;
$this->interface = $interface;
$this->port = (int) $port;
if ($port < 1 or $port > 65536) {
throw new \Exception("Invalid port range");
}
$this->setClassLoader($loader);
$this->shutdown = false;
$this->externalQueue = new \Threaded();
$this->internalQueue = new \Threaded();
if (\Phar::running(true) !== "") {
$this->mainPath = \Phar::running(true);
} else {
$this->mainPath = \getcwd() . DIRECTORY_SEPARATOR;
}
$this->start();
}