Open ghost opened 7 years ago
Any idea why chatserver.php exits right after running?
root@lamp post/chat# php chatserver.php
Server started
Listening on: 192.168.1.3:9000
Master socket: Resource id #6
root@lamp post/chat#
Based off of the information given?
No.
I have plans to add logging, but obviously that doesn't help right now.
I suspect that something is happening to the master socket resource between when it's created and when you get your first connection (or even actually listening for that connection), but that's pure conjecture on my part.
Had to add this at the end of chatserver.php file.
try {
$server->run();
}
catch (Exception $e) {
$server->stdout($e->getMessage());
}
I had to modify the first line to the path of php as follows
`
! /usr/bin/php7.0
<?php
require_once('websockets.php');
class ChatServer extends WebSocketServer {
}
$server = new ChatServer("192.168.0.3","9000"); `
When I run it using ./chatserver.php
wh33t@wh33tserv:/var/www/html/d30/socketest$ ./chatserver.php Server started Listening on: 192.168.0.3:9000 Master socket: Resource id #6 wh33t@wh33tserv:/var/www/html/d30/socketest$
It just exits. I haven't modified anything else. What am I doing wrong?
Also, not sure why the formatting isn't working.