(PHP code) Gracefully handling the failure of TCP resources
function check_tcp_active($host, $port) { $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array( "sec"=>0, "usec"=>500 ) ); $result = @socket_connect($socket,…