tags:

views:

26

answers:

2

I'm connecting to a remote host as follows:

$conn = stream_socket_client("ssl://$host:$port", $e_code, $e_string, 2, STREAM_CLIENT_CONNECT, $ctx);

How should I interpret the error code?

The docs say the error code "holds the system level error number that occurred in the system-level connect() call."

I can't find any PHP constants which define these error codes.

A: 

The variable $e_string which you are passing by reference will contain a str string equivalent of the error, if an error occurs.

codaddict
A: 

Connect() defines some errors it can return, like EACCES or ECONNREFUSED. These constants correspond with a number.

Sjoerd