Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

./chatserver.php exits right after running. #99

Open
ghost opened this issue May 23, 2017 · 3 comments
Open

./chatserver.php exits right after running. #99

ghost opened this issue May 23, 2017 · 3 comments

Comments

@ghost
Copy link

ghost commented May 23, 2017

I had to modify the first line to the path of php as follows

`
#! /usr/bin/php7.0

users as $u) { $message = htmlspecialchars($message); $this->send($u,$message); } } protected function connected($user) { } protected function closed($user) { } } $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.
@zelenko
Copy link

zelenko commented Oct 25, 2017

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#

@ghedipunk
Copy link
Owner

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.

@zelenko
Copy link

zelenko commented Oct 25, 2017

Had to add this at the end of chatserver.php file.

try {
    $server->run();
  }
  catch (Exception $e) {
    $server->stdout($e->getMessage());
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants