PHP Websocket echo server crashes -


We are using a websocket algorithm on a dedicated server running with apache and php5, everything works properly Sometimes, we create errors without any errors in the eco server crash algorithm (the comment in this part of the code):

  $ numbytes = @socket_recv ($ socket, $ Buffer, $ this-> Max buffer size, 0); If ($ numBytes === incorrect) {/ * 110: connection time has expired / / * 113: no root to host / / * 104: connection reset by peer * / $ error_msg = socket_strorror (socket_last_error) ($ Socket)); Socket_close ($ this-> Master); New exception throw ('socket error:'. $ Error_msg); }  

This code part is within infinite time, while I do not paste everything and nothing to keep the post clean, but feel free to ask me more code Someone knows why these errors happen, and do they have a way of not breaking the whole script?

The way the server is started here:

  $ this - & gt; Maxbuferies = 2048; $ This- & gt; Master = socket_create (AF_INET, SOCK_STREAM, SOL_TCP) or die ("Failed: Socket_create ()"); Socket_set_option ($ this-> Master, SOL_SOCKET, SO_REUSEADDR, 1) or die ("Fail: socket_poption () (reuse address)"); Socket_set_option ($ this-> Master, SOL_SOCKET, SO_RCVTIMEO, Array ("sec" => 1, "usec" => 100)) or die ("Fail: socket_poption () (timeout)"); Socket_bind ($ this-> Master, $ ADR, $ port) or die ("Fail: socket_bind ()"); Socket_listen ($ this-> Master) or die ("Failed: socket_listen ()"); $ This- & gt; Chairs ['m'] = $ this- & gt; master;  


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -