stream_socket_client unable to connect (connection timed out)

I had fixed the issue by opening the port 2195 on the production server. You can verify by following command $telnet gateway.push.apple.com 2195

-bash-3.2# telnet gateway.push.apple.com 2195

Trying 17.149.38.141...
Connected to gateway.push.apple.com (17.149.38.141).
Escape character is '^]'.
Connection closed by foreign host.

Check your personal firewall settings and make sure you're not blocking this out. Try disabling the firewall.

Also, some APIs like requests to come from an actual domain rather than a desktop. I don't have reason to believe Apple works this way, but that's something to check also.

Also make sure and ping gateway.sandbox.push.apple.com and make sure you have a good connection.