Fixing a bug

This commit is contained in:
Ad5001 2016-05-31 19:43:30 +02:00
parent 03643fb4af
commit 26a0822850
2 changed files with 2 additions and 0 deletions

View file

@ -33,6 +33,7 @@ $port = $this->getConfig()->get("port");
$sock = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n"); $sock = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
$result = socket_bind($sock, $address, $port) or die('Could not bind to address'); $result = socket_bind($sock, $address, $port) or die('Could not bind to address');
$this->getLogger()->info("Website open in port §a" . $port);
$this->socket = new isOnlineTask($this, $sock, $this->getDataFolder()); $this->socket = new isOnlineTask($this, $sock, $this->getDataFolder());
$this->getServer()->getScheduler()->scheduleRepeatingTask($this->socket, $this->getConfig()->get("TimePerConnection")); $this->getServer()->getScheduler()->scheduleRepeatingTask($this->socket, $this->getConfig()->get("TimePerConnection"));

View file

@ -29,6 +29,7 @@ use pocketmine\math\Vector3;
$this->isRunning = false; $this->isRunning = false;
} }
public function onRun() { public function onRun() {
socket_listen($this->sock);
$sock = $this->sock; $sock = $this->sock;
$client = socket_accept($sock); $client = socket_accept($sock);
$input = socket_read($client, 1024); $input = socket_read($client, 1024);