Come on. I'm having a script in PHP that serves to create a websocket server for my application. I'm using the HTML5 websocket.
To create the server, I am using the Ratchet library found on socketo.me .
Turn this code down from the command line:
list ($host, $port) = $argv + ['localhost', 9000];
$app = new Ratchet\App($host, $port, '0.0.0.0');
$app->route('/chat', new Chat, array('*'));
$app->route('/notificador', new Notificador, array('*'));
$app->run();
Everything was working perfectly. Suddenly, this service stopped working. I tried to use the same command to start it again, but the following message always appears:
Could not bind to tcp: //127.0.0.1: 8843: Can not assign requested address
It's important to explain that I do not use port 8843 to run this script, I use port 9000. But the Ratchet library does.
An excerpt from the constructor of class Ratchet\App
:
if (80 == $port) {
$flashSock->listen(843, '0.0.0.0');
} else {
$flashSock->listen(8843);
}
In turn the listen
method has the following excerpt:
$this->master = @stream_socket_server("tcp://$host:$port", $errno, $errstr);
if (false === $this->master) {
$message = "Could not bind to tcp://$host:$port: $errstr";
throw new ConnectionException($message, $errno);
}
The strange thing is that I have already called the staff of dialhost
, where we have the hosting and it has been verified that there is no service running on that port. So it would not be a "door already busy" error.
What have I tried to do?
-
I asked to restart the server (Linux).
-
The dialhost employee said the door is not busy. He claimed to have verified this via command
telnet
. -
I have already run the command
fuser -k 8843/tcp
to try to kill some process that was occupying that port.
Could not bind to tcp: //0.0.0.0: 9001: Address already in use
... but nothing solved!
And now, who can help me?