Closed guillaumeinnov24 closed 9 years ago
it may come from:
$numBytes = @socket_recv($socket,$buffer,$this->maxBufferSize,0);
if ($numBytes === false) {
throw new Exception('Socket error: ' . socket_strerror(socket_last_error($socket)));
}
PHP Fatal error: Uncaught exception 'Exception' with message 'Socket error: Connection reset by peer'
*** thrown in PHP_Websockets/WebSockets.php on line 98 ***
I'll have to play with nmap to see what it's actually doing.
From your messages, it looks like both nmap and the server think that the other is closing the connection.
I'll start putting in additional error handling. The worst that nmap should be seeing would be a HTTP 400 error, but it seems that the unhandled exception is terminating the server for a simple closed connection before the handshake is complete.
Things I'm adding on my to-do list:
Log uncaught exceptions (especially during handshake) rather than terminating, with verbose complaining output to the terminal.
Investigate nmap's behavior.
Unusual client disconnects (or any socket error, for that matter) no longer throw an exception.
(great job btw!) I'm still on the example. Launching testwebsock.php works fine, but asa a nmap scan occured, a RST packet is received and the connection fail fatally. Dropping data.
Server started Listening on: 0.0.0.0:9000 Master socket: Resource id #6 Client connected. Resource id #7