php - Best way to wait for socket response -


i have php client (tcp/ip) sends request server , receives response. response might not come immediately, 1 sec, 10 sec, 1 minute or maybe more (the response dependent on user action).

what best way wait response. i'm setting read timeout, i'm not sure best way it:

socket_set_option($this->socket ,sol_socket, so_rcvtimeo, array(     "sec" => 120,      "usec" => 0 )); 

is there way detect when data ready read? other using socket_read , risk "unable read socket [10060]" error on timeout? have looked @ documentation, doesn't give me clues.

hope can help.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -