Predefined Constants

The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

AF_UNIX (int)
AF_INET (int)
AF_INET6 (int)
Only available if compiled with IPv6 support.
SOCK_STREAM (int)
SOCK_DGRAM (int)
SOCK_RAW (int)
SOCK_SEQPACKET (int)
SOCK_RDM (int)
MSG_OOB (int)
MSG_WAITALL (int)
MSG_PEEK (int)
MSG_DONTROUTE (int)
MSG_EOR (int)
Not available on Windows platforms.
MSG_EOF (int)
Not available on Windows platforms.
SO_DEBUG (int)
SO_REUSEADDR (int)
SO_REUSEPORT (int)
This constant is only available on platforms that support the SO_REUSEPORT socket option: this includes macOS and FreeBSD, but does not include Linux or Windows.
SO_KEEPALIVE (int)
SO_DONTROUTE (int)
SO_LINGER (int)
SO_BROADCAST (int)
SO_OOBINLINE (int)
SO_SNDBUF (int)
SO_RCVBUF (int)
SO_SNDLOWAT (int)
SO_RCVLOWAT (int)
SO_SNDTIMEO (int)
SO_RCVTIMEO (int)
SO_TYPE (int)
SO_ERROR (int)
TCP_NODELAY (int)
Used to disable Nagle TCP algorithm.
SO_MARK (int)
Available as of PHP 8.1.0
Available as of PHP 8.1.0
SO_ACCEPTFILTER (string)
Available as of PHP 8.1.0
SO_DONTTRUNC (int)
Available as of PHP 8.1.0
SO_WANTMORE (int)
Available as of PHP 8.1.0
TCP_DEFER_ACCEPT (int)
Available as of PHP 8.1.0
SOL_SOCKET (int)
PHP_NORMAL_READ (int)
PHP_BINARY_READ (int)
SOL_TCP (int)
SOL_UDP (int)

The following constants are defined under Windows and UNIX-like platforms. Each constant is only defined if their equal is available on the platform.

SOCKET_EINTR (int)
Interrupted system call.
SOCKET_EBADF (int)
Bad file number.
SOCKET_EACCES (int)
Permission denied.
SOCKET_EFAULT (int)
Bad address.
SOCKET_EINVAL (int)
Invalid argument.
SOCKET_EMFILE (int)
Too many open files.
SOCKET_ENAMETOOLONG (int)
File name too long.
SOCKET_ENOTEMPTY (int)
Directory not empty.
SOCKET_ELOOP (int)
Too many symbolic links encountered.
SOCKET_EWOULDBLOCK (int)
Operation would block.
SOCKET_EREMOTE (int)
Object is remote.
SOCKET_EUSERS (int)
Too many users.
SOCKET_ENOTSOCK (int)
Socket operation on non-socket.
SOCKET_EDESTADDRREQ (int)
Destination address required.
SOCKET_EMSGSIZE (int)
Message too long.
SOCKET_EPROTOTYPE (int)
Protocol wrong type for socket.
SOCKET_EPROTONOSUPPORT (int)
Protocol not supported.
SOCKET_ESOCKTNOSUPPORT (int)
Socket type not supported.
SOCKET_EOPNOTSUPP (int)
Operation not supported on transport endpoint.
SOCKET_EPFNOSUPPORT (int)
Protocol family not supported.
SOCKET_EAFNOSUPPORT (int)
Address family not supported by protocol.
SOCKET_EADDRNOTAVAIL (int)
Cannot assign requested address.
SOCKET_ENETDOWN (int)
Network is down.
SOCKET_ENETUNREACH (int)
Network is unreachable.
SOCKET_ENETRESET (int)
Network dropped connection because of reset.
SOCKET_ECONNABORTED (int)
Software caused connection abort.
SOCKET_ECONNRESET (int)
Connection reset by peer.
SOCKET_ENOBUFS (int)
No buffer space available.
SOCKET_EISCONN (int)
Transport endpoint is already connected.
SOCKET_ENOTCONN (int)
Transport endpoint is not connected.
SOCKET_ESHUTDOWN (int)
Cannot send after transport endpoint shutdown.
SOCKET_ETIMEDOUT (int)
Connection timed out.
SOCKET_ECONNREFUSED (int)
Connection refused.
SOCKET_EHOSTDOWN (int)
Host is down.
SOCKET_EHOSTUNREACH (int)
No route to host.
SOCKET_EALREADY (int)
Operation already in progress.
SOCKET_EINPROGRESS (int)
Operation now in progress.

The following constants are only defined under Windows.

SOCKET_ENOPROTOOPT (int)
SOCKET_EADDRINUSE (int)
SOCKET_ETOOMYREFS (int)
SOCKET_EPROCLIM (int)
SOCKET_EDUOT (int)
SOCKET_ESTALE (int)
SOCKET_EDISCON (int)
SOCKET_SYSNOTREADY (int)
SOCKET_VERNOTSUPPORTED (int)
SOCKET_NOTINITIALISED (int)
SOCKET_HOST_NOT_FOUND (int)
SOCKET_TRY_AGAIN (int)
SOCKET_NO_RECOVERY (int)
SOCKET_NO_DATA (int)
SOCKET_NO_ADDRESS (int)

The following constants are only available on UNIX-like platforms. Each constant is only defined if their equal is available on the platform.

SOCKET_EPERM (int)
Operation not permitted.
SOCKET_ENOENT (int)
No such file or directory.
SOCKET_EIO (int)
I/O error.
SOCKET_ENXIO (int)
No such device or address.
SOCKET_E2BIG (int)
Arg list too long.
SOCKET_EAGAIN (int)
Try again.
SOCKET_ENOMEM (int)
Out of memory.
SOCKET_ENOTBLK (int)
Block device required.
SOCKET_EBUSY (int)
Device or resource busy.
SOCKET_EEXIST (int)
File exists.
SOCKET_EXDEV (int)
Cross-device link.
SOCKET_ENODEV (int)
No such device.
SOCKET_ENOTDIR (int)
Not a directory.
SOCKET_EISDIR (int)
Is a directory.
SOCKET_ENFILE (int)
File table overflow.
SOCKET_ENOTTY (int)
Not a typewriter.
SOCKET_ENOSPC (int)
No space left on device.
SOCKET_ESPIPE (int)
Illegal seek.
SOCKET_EROFS (int)
Read-only file system.
Too many links.
SOCKET_EPIPE (int)
Broken pipe.
SOCKET_ENOLCK (int)
No record locks available.
SOCKET_ENOSYS (int)
Function not implemented.
SOCKET_ENOMSG (int)
No message of desired type.
SOCKET_EIDRM (int)
Identifier removed.
SOCKET_ECHRNG (int)
Channel number out of range.
SOCKET_EL2NSYNC (int)
Level 2 not synchronized.
SOCKET_EL3HLT (int)
Level 3 halted.
SOCKET_EL3RST (int)
Level 3 reset.
SOCKET_ELNRNG (int)
Link number out of range.
SOCKET_EUNATCH (int)
Protocol driver not attached.
SOCKET_ENOCSI (int)
No CSI structure available.
SOCKET_EL2HLT (int)
Level 2 halted.
SOCKET_EBADE (int)
Invalid exchange.
SOCKET_EBADR (int)
Invalid request descriptor.
SOCKET_EXFULL (int)
Exchange full.
SOCKET_ENOANO (int)
No anode.
SOCKET_EBADRQC (int)
Invalid request code.
SOCKET_EBADSLT (int)
Invalid slot.
SOCKET_ENOSTR (int)
Device not a stream.
SOCKET_ENODATA (int)
No data available.
SOCKET_ETIME (int)
Timer expired.
SOCKET_ENOSR (int)
Out of streams resources.
SOCKET_ENONET (int)
Machine is not on the network.
Link has been severed.
SOCKET_EADV (int)
Advertise error.
SOCKET_ESRMNT (int)
Srmount error.
SOCKET_ECOMM (int)
Communication error on send.
SOCKET_EPROTO (int)
Protocol error.
SOCKET_EMULTIHOP (int)
Multihop attempted.
SOCKET_EBADMSG (int)
Not a data message.
SOCKET_ENOTUNIQ (int)
Name not unique on network.
SOCKET_EBADFD (int)
File descriptor in bad state.
SOCKET_EREMCHG (int)
Remote address changed.
SOCKET_ERESTART (int)
Interrupted system call should be restarted.
SOCKET_ESTRPIPE (int)
Streams pipe error.
SOCKET_EPROTOOPT (int)
Protocol not available.
SOCKET_ADDRINUSE (int)
Address already in use.
SOCKET_ETOOMANYREFS (int)
Too many references: cannot splice.
SOCKET_EISNAM (int)
Is a named type file.
SOCKET_EREMOTEIO (int)
Remote I/O error.
SOCKET_EDQUOT (int)
Quota exceeded.
SOCKET_ENOMEDIUM (int)
No medium found.
SOCKET_EMEDIUMTYPE (int)
Wrong medium type.
SCM_RIGHTS (int)
Send or receive a set of open file descriptors from another process.
SCM_CREDENTIALS (int)