A socket error.
Protected Properties | |
mixed | $extra |
Extra data, if any. More... | |
Public Static Methods | |
static int | getLast ($resource=null) |
Retrieves and clears the socket error. More... | |
Public Methods | |
__construct ($subject=null, $fallback=0, SocketError $previous=null) | |
Initializes the error based on a mixed subject. More... | |
mixed | getExtra () |
$this | setExtra ($extra) |
|
protected |
Extra data, if any.
The specific contents are documented where the error is thrown.
__construct | ( | $subject = null , |
|
$fallback = 0 , |
|||
SocketError | $previous = null |
||
) |
Initializes the error based on a mixed subject.
PHP's core socket functions like to return false
without setting errno
in some places.
To account for that scenario, a fallback code can be given.
When the fallback code is used, PHP's last suppressed warning message is used.
All scenarios within this library have been meticulously cross-checked with the PHP C source code for cases where a fallback code is necessary.
int | resource | null | $subject | Error constant, resource to check, or NULL to use the global socket error. |
int | $fallback | Code to assume if one can't be found via the subject. |
SocketError | null | $previous | Slippage of a prior error. |
mixed getExtra | ( | ) |
|
static |
Retrieves and clears the socket error.
For resources, this favors SO_ERROR
, then falls back to the error number set by PHP. Both error codes are cleared.
resource | $resource | PHP socket resource, or null for the global error. |
SOCKET_EBADF
is returned. $this setExtra | ( | $extra | ) |
mixed | $extra |