@@ -50,7 +50,7 @@ public function setConnectionHandler( $handler ) {
5050 public function listen () {
5151 if ( socket_listen ($ this ->sockServer , 5 ) === false ) {
5252 throw new SocketException (
53- SocketException::CANT_BIND_SOCKET ,
53+ SocketException::CANT_LISTEN ,
5454 socket_strerror (socket_last_error ( $ this ->sockServer ) ) );
5555 }
5656
@@ -67,23 +67,23 @@ protected function beforeServerLoop() {
6767
6868 protected function serverLoop () {
6969 while ( $ this ->_listenLoop ) {
70- if ( ( $ client = @socket_accept ( $ this ->sockServer ) ) === false ) {
71- throw new SocketException (
72- SocketException::CANT_ACCEPT ,
73- socket_strerror (socket_last_error ( $ this ->sockServer ) ) );
74- continue ;
75- }
76-
77- $ socketClient = new SocketClient ( $ client );
78-
79- if ( is_array ( $ this ->connectionHandler ) ) {
80- $ object = $ this ->connectionHandler [0 ];
81- $ method = $ this ->connectionHandler [1 ];
82- $ object ->$ method ( $ socketClient );
83- }
84- else {
85- $ function = $ this ->connectionHandler ;
86- $ function ( $ socketClient );
70+ if ( ( $ client = @socket_accept ( $ this ->sockServer ) ) === false ) {
71+ throw new SocketException (
72+ SocketException::CANT_ACCEPT ,
73+ socket_strerror (socket_last_error ( $ this ->sockServer ) ) );
74+ continue ;
75+ }
76+
77+ $ socketClient = new SocketClient ( $ client );
78+
79+ if ( is_array ( $ this ->connectionHandler ) ) {
80+ $ object = $ this ->connectionHandler [0 ];
81+ $ method = $ this ->connectionHandler [1 ];
82+ $ object ->$ method ( $ socketClient );
83+ }
84+ else {
85+ $ function = $ this ->connectionHandler ;
86+ $ function ( $ socketClient );
8787 }
8888 }
8989 }
0 commit comments