我们可以使用以下代码了解套接字常量的值
<?php
$a = get_defined_constants(TRUE) ;
foreach ( $a['sockets'] as $constant => $value ) {
printf("%-25s %d\r\n", $constant, $value) ;
}
?>
AF_UNIX 1
AF_INET 2
AF_INET6 23
SOCK_STREAM 1
SOCK_DGRAM 2
SOCK_RAW 3
SOCK_SEQPACKET 5
SOCK_RDM 4
MSG_OOB 1
MSG_WAITALL 0
MSG_PEEK 2
MSG_DONTROUTE 4
SO_DEBUG 1
SO_REUSEADDR 4
SO_KEEPALIVE 8
SO_DONTROUTE 16
SO_LINGER 128
SO_BROADCAST 32
SO_OOBINLINE 256
SO_SNDBUF 4097
SO_RCVBUF 4098
SO_SNDLOWAT 4099
SO_RCVLOWAT 4100
SO_SNDTIMEO 4101
SO_RCVTIMEO 4102
SO_TYPE 4104
SO_ERROR 4103
SOL_SOCKET 65535
SOMAXCONN 2147483647
TCP_NODELAY 1
PHP_NORMAL_READ 1
PHP_BINARY_READ 2
SOCKET_EINTR 10004
SOCKET_EBADF 10009
SOCKET_EACCES 10013
SOCKET_EFAULT 10014
SOCKET_EINVAL 10022
SOCKET_EMFILE 10024
SOCKET_EWOULDBLOCK 10035
SOCKET_EINPROGRESS 10036
SOCKET_EALREADY 10037
SOCKET_ENOTSOCK 10038
SOCKET_EDESTADDRREQ 10039
SOCKET_EMSGSIZE 10040
SOCKET_EPROTOTYPE 10041
SOCKET_ENOPROTOOPT 10042
SOCKET_EPROTONOSUPPORT 10043
SOCKET_ESOCKTNOSUPPORT 10044
SOCKET_EOPNOTSUPP 10045
SOCKET_EPFNOSUPPORT 10046
SOCKET_EAFNOSUPPORT 10047
SOCKET_EADDRINUSE 10048
SOCKET_EADDRNOTAVAIL 10049
SOCKET_ENETDOWN 10050
SOCKET_ENETUNREACH 10051
SOCKET_ENETRESET 10052
SOCKET_ECONNABORTED 10053
SOCKET_ECONNRESET 10054
SOCKET_ENOBUFS 10055
SOCKET_EISCONN 10056
SOCKET_ENOTCONN 10057
SOCKET_ESHUTDOWN 10058
SOCKET_ETOOMANYREFS 10059
SOCKET_ETIMEDOUT 10060
SOCKET_ECONNREFUSED 10061
SOCKET_ELOOP 10062
SOCKET_ENAMETOOLONG 10063
SOCKET_EHOSTDOWN 10064
SOCKET_EHOSTUNREACH 10065
SOCKET_ENOTEMPTY 10066
SOCKET_EPROCLIM 10067
SOCKET_EUSERS 10068
SOCKET_EDQUOT 10069
SOCKET_ESTALE 10070
SOCKET_EREMOTE 10071
SOCKET_EDISCON 10101
SOCKET_SYSNOTREADY 10091
SOCKET_VERNOTSUPPORTED 10092
SOCKET_NOTINITIALISED 10093
SOCKET_HOST_NOT_FOUND 11001
SOCKET_TRY_AGAIN 11002
SOCKET_NO_RECOVERY 11003
SOCKET_NO_DATA 11004
SOCKET_NO_ADDRESS 11004
SOL_TCP 6
SOL_UDP 17