1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020
|
<?php
// Start of sockets v.
/**
* Runs the select() system call on the given arrays of sockets with a specified timeout
* @link http://www.php.net/manual/en/function.socket-select.php
* @param read array <p>
* The sockets listed in the read array will be
* watched to see if characters become available for reading (more
* precisely, to see if a read will not block - in particular, a socket
* resource is also ready on end-of-file, in which case a
* socket_read will return a zero length string).
* </p>
* @param write array <p>
* The sockets listed in the write array will be
* watched to see if a write will not block.
* </p>
* @param except array <p>
* The sockets listed in the except array will be
* watched for exceptions.
* </p>
* @param tv_sec int <p>
* The tv_sec and tv_usec
* together form the timeout parameter. The
* timeout is an upper bound on the amount of time
* elapsed before socket_select return.
* tv_sec may be zero , causing
* socket_select to return immediately. This is useful
* for polling. If tv_sec is &null; (no timeout),
* socket_select can block indefinitely.
* </p>
* @param tv_usec int[optional] <p>
* </p>
* @return int On success socket_select returns the number of
* socket resources contained in the modified arrays, which may be zero if
* the timeout expires before anything interesting happens. On error false
* is returned. The error code can be retrieved with
* socket_last_error.
* </p>
*
* <p>
* Be sure to use the === operator when checking for an
* error. Since the socket_select may return 0 the
* comparison with == would evaluate to true:
*
* Understanding socket_select's result
*
* ]]>
*/
function socket_select (array &$read, array &$write, array &$except, $tv_sec, $tv_usec = null) {}
/**
* Create a socket (endpoint for communication)
* @link http://www.php.net/manual/en/function.socket-create.php
* @param domain int <p>
* The domain parameter specifies the protocol
* family to be used by the socket.
* </p>
* <table>
* Available address/protocol families
*
*
* <tr valign="top">
* <td>Domain</td>
* <td>Description</td>
* </tr>
*
*
* <tr valign="top">
* <td>AF_INET</td>
* <td>
* IPv4 Internet based protocols. TCP and UDP are common protocols of
* this protocol family.
* </td>
* </tr>
* <tr valign="top">
* <td>AF_INET6</td>
* <td>
* IPv6 Internet based protocols. TCP and UDP are common protocols of
* this protocol family.
* </td>
* </tr>
* <tr valign="top">
* <td>AF_UNIX</td>
* <td>
* Local communication protocol family. High efficiency and low
* overhead make it a great form of IPC (Interprocess Communication).
* </td>
* </tr>
*
*
* </table>
* @param type int <p>
* The type parameter selects the type of communication
* to be used by the socket.
* </p>
* <table>
* Available socket types
*
*
* <tr valign="top">
* <td>Type</td>
* <td>Description</td>
* </tr>
*
*
* <tr valign="top">
* <td>SOCK_STREAM</td>
* <td>
* Provides sequenced, reliable, full-duplex, connection-based byte streams.
* An out-of-band data transmission mechanism may be supported.
* The TCP protocol is based on this socket type.
* </td>
* </tr>
* <tr valign="top">
* <td>SOCK_DGRAM</td>
* <td>
* Supports datagrams (connectionless, unreliable messages of a fixed maximum length).
* The UDP protocol is based on this socket type.
* </td>
* </tr>
* <tr valign="top">
* <td>SOCK_SEQPACKET</td>
* <td>
* Provides a sequenced, reliable, two-way connection-based data transmission path for
* datagrams of fixed maximum length; a consumer is required to read an
* entire packet with each read call.
* </td>
* </tr>
* <tr valign="top">
* <td>SOCK_RAW</td>
* <td>
* Provides raw network protocol access. This special type of socket
* can be used to manually construct any type of protocol. A common use
* for this socket type is to perform ICMP requests (like ping).
* </td>
* </tr>
* <tr valign="top">
* <td>SOCK_RDM</td>
* <td>
* Provides a reliable datagram layer that does not guarantee ordering.
* This is most likely not implemented on your operating system.
* </td>
* </tr>
*
*
* </table>
* @param protocol int <p>
* The protocol parameter sets the specific
* protocol within the specified domain to be used
* when communicating on the returned socket. The proper value can be
* retrieved by name by using getprotobyname. If
* the desired protocol is TCP, or UDP the corresponding constants
* SOL_TCP, and SOL_UDP
* can also be used.
* </p>
* <table>
* Common protocols
*
*
* <tr valign="top">
* <td>Name</td>
* <td>Description</td>
* </tr>
*
*
* <tr valign="top">
* <td>icmp</td>
* <td>
* The Internet Control Message Protocol is used primarily by gateways
* and hosts to report errors in datagram communication. The "ping"
* command (present in most modern operating systems) is an example
* application of ICMP.
* </td>
* </tr>
* <tr valign="top">
* <td>udp</td>
* <td>
* The User Datagram Protocol is a connectionless, unreliable,
* protocol with fixed record lengths. Due to these aspects, UDP
* requires a minimum amount of protocol overhead.
* </td>
* </tr>
* <tr valign="top">
* <td>tcp</td>
* <td>
* The Transmission Control Protocol is a reliable, connection based,
* stream oriented, full duplex protocol. TCP guarantees that all data packets
* will be received in the order in which they were sent. If any packet is somehow
* lost during communication, TCP will automatically retransmit the packet until
* the destination host acknowledges that packet. For reliability and performance
* reasons, the TCP implementation itself decides the appropriate octet boundaries
* of the underlying datagram communication layer. Therefore, TCP applications must
* allow for the possibility of partial record transmission.
* </td>
* </tr>
*
*
* </table>
* @return resource socket_create returns a socket resource on success,
* or false on error. The actual error code can be retrieved by calling
* socket_last_error. This error code may be passed to
* socket_strerror to get a textual explanation of the
* error.
*/
function socket_create ($domain, $type, $protocol) {}
/**
* Opens a socket on port to accept connections
* @link http://www.php.net/manual/en/function.socket-create-listen.php
* @param port int <p>
* The port on which to listen on all interfaces.
* </p>
* @param backlog int[optional] <p>
* The backlog parameter defines the maximum length
* the queue of pending connections may grow to.
* SOMAXCONN may be passed as
* backlog parameter, see
* socket_listen for more information.
* </p>
* @return resource socket_create_listen returns a new socket resource
* on success or false on error. The error code can be retrieved with
* socket_last_error. This code may be passed to
* socket_strerror to get a textual explanation of the
* error.
*/
function socket_create_listen ($port, $backlog = null) {}
/**
* Creates a pair of indistinguishable sockets and stores them in an array
* @link http://www.php.net/manual/en/function.socket-create-pair.php
* @param domain int <p>
* The domain parameter specifies the protocol
* family to be used by the socket. See socket_create
* for the full list.
* </p>
* @param type int <p>
* The type parameter selects the type of communication
* to be used by the socket. See socket_create for the
* full list.
* </p>
* @param protocol int <p>
* The protocol parameter sets the specific
* protocol within the specified domain to be used
* when communicating on the returned socket. The proper value can be retrieved by
* name by using getprotobyname. If
* the desired protocol is TCP, or UDP the corresponding constants
* SOL_TCP, and SOL_UDP
* can also be used.
* </p>
* <p>
* See socket_create for the full list of supported
* protocols.
* </p>
* @param fd array <p>
* Reference to an array in which the two socket resources will be inserted.
* </p>
* @return bool Returns true on success, false on failure.
*/
function socket_create_pair ($domain, $type, $protocol, array &$fd) {}
/**
* Accepts a connection on a socket
* @link http://www.php.net/manual/en/function.socket-accept.php
* @param socket resource <p>
* A valid socket resource created with socket_create.
* </p>
* @return resource a new socket resource on success, or false on error. The actual
* error code can be retrieved by calling
* socket_last_error. This error code may be passed to
* socket_strerror to get a textual explanation of the
* error.
*/
function socket_accept ($socket) {}
/**
* Sets nonblocking mode for file descriptor fd
* @link http://www.php.net/manual/en/function.socket-set-nonblock.php
* @param socket resource <p>
* A valid socket resource created with socket_create
* or socket_accept.
* </p>
* @return bool Returns true on success, false on failure.
*/
function socket_set_nonblock ($socket) {}
/**
* Sets blocking mode on a socket resource
* @link http://www.php.net/manual/en/function.socket-set-block.php
* @param socket resource <p>
* A valid socket resource created with socket_create
* or socket_accept.
* </p>
* @return bool Returns true on success, false on failure.
*/
function socket_set_block ($socket) {}
/**
* Listens for a connection on a socket
* @link http://www.php.net/manual/en/function.socket-listen.php
* @param socket resource <p>
* A valid socket resource created with socket_create.
* </p>
* @param backlog int[optional] <p>
* A maximum of backlog incoming connections will be
* queued for processing. If a connection request arrives with the queue
* full the client may receive an error with an indication of
* ECONNREFUSED, or, if the underlying protocol supports
* retransmission, the request may be ignored so that retries may succeed.
* </p>
*
* <p>
* The maximum number passed to the backlog
* parameter highly depends on the underlying platform. On Linux, it is
* silently truncated to SOMAXCONN. On win32, if
* passed SOMAXCONN, the underlying service provider
* responsible for the socket will set the backlog to a maximum
* reasonable value. There is no standard provision to
* find out the actual backlog value on this platform.
* </p>
* @return bool Returns true on success, false on failure. The error code can be retrieved with
* socket_last_error. This code may be passed to
* socket_strerror to get a textual explanation of the
* error.
*/
function socket_listen ($socket, $backlog = null) {}
/**
* Closes a socket resource
* @link http://www.php.net/manual/en/function.socket-close.php
* @param socket resource <p>
* A valid socket resource created with socket_create
* or socket_accept.
* </p>
* @return void
*/
function socket_close ($socket) {}
/**
* Write to a socket
* @link http://www.php.net/manual/en/function.socket-write.php
* @param socket resource <p>
* </p>
* @param buffer string <p>
* The buffer to be written.
* </p>
* @param length int[optional] <p>
* The optional parameter length can specify an
* alternate length of bytes written to the socket. If this length is
* greater than the buffer length, it is silently truncated to the length
* of the buffer.
* </p>
* @return int the number of bytes successfully written to the socket&return.falseforfailure;.
* The error code can be retrieved with
* socket_last_error. This code may be passed to
* socket_strerror to get a textual explanation of the
* error.
* </p>
*
* <p>
* It is perfectly valid for socket_write to
* return zero which means no bytes have been written. Be sure to use the
* === operator to check for false in case of an
* error.
*/
function socket_write ($socket, $buffer, $length = null) {}
/**
* Reads a maximum of length bytes from a socket
* @link http://www.php.net/manual/en/function.socket-read.php
* @param socket resource <p>
* A valid socket resource created with socket_create
* or socket_accept.
* </p>
* @param length int <p>
* The maximum number of bytes read is specified by the
* length parameter. Otherwise you can use
* \r, \n,
* or \0 to end reading (depending on the type
* parameter, see below).
* </p>
* @param type int[optional] <p>
* Optional type parameter is a named constant:
*
*
*
* PHP_BINARY_READ (Default) - use the system
* recv() function. Safe for reading binary data.
* @return string socket_read returns the data as a string on success,
* or false on error (including if the remote host has closed the
* connection). The error code can be retrieved with
* socket_last_error. This code may be passed to
* socket_strerror to get a textual representation of
* the error.
* </p>
*
* <p>
* socket_read returns a zero length string ("")
* when there is no more data to read.
*/
function socket_read ($socket, $length, $type = null) {}
/**
* Queries the local side of the given socket which may either result in host/port or in a Unix filesystem path, dependent on its type
* @link http://www.php.net/manual/en/function.socket-getsockname.php
* @param socket resource <p>
* A valid socket resource created with socket_create
* or socket_accept.
* </p>
* @param addr string <p>
* If the given socket is of type AF_INET
* or AF_INET6, socket_getsockname
* will return the local IP address in appropriate notation (e.g.
* 127.0.0.1 or fe80::1) in the
* address parameter and, if the optional
* port parameter is present, also the associated port.
* </p>
* <p>
* If the given socket is of type AF_UNIX,
* socket_getsockname will return the Unix filesystem
* path (e.g. /var/run/daemon.sock) in the
* address parameter.
* </p>
* @param port int[optional] <p>
* If provided, this will hold the associated port.
* </p>
* @return bool Returns true on success, false on failure. socket_getsockname may also return
* false if the socket type is not any of AF_INET,
* AF_INET6, or AF_UNIX, in which
* case the last socket error code is not updated.
*/
function socket_getsockname ($socket, &$addr, &$port = null) {}
/**
* Queries the remote side of the given socket which may either result in host/port or in a Unix filesystem path, dependent on its type
* @link http://www.php.net/manual/en/function.socket-getpeername.php
* @param socket resource <p>
* A valid socket resource created with socket_create
* or socket_accept.
* </p>
* @param address string <p>
* If the given socket is of type AF_INET or
* AF_INET6, socket_getpeername
* will return the peers (remote) IP address in
* appropriate notation (e.g. 127.0.0.1 or
* fe80::1) in the address
* parameter and, if the optional port parameter is
* present, also the associated port.
* </p>
* <p>
* If the given socket is of type AF_UNIX,
* socket_getpeername will return the Unix filesystem
* path (e.g. /var/run/daemon.sock) in the
* address parameter.
* </p>
* @param port int[optional] <p>
* If given, this will hold the port associated to
* address.
* </p>
* @return bool Returns true on success, false on failure. socket_getpeername may also return
* false if the socket type is not any of AF_INET,
* AF_INET6, or AF_UNIX, in which
* case the last socket error code is not updated.
*/
function socket_getpeername ($socket, &$address, &$port = null) {}
/**
* Initiates a connection on a socket
* @link http://www.php.net/manual/en/function.socket-connect.php
* @param socket resource <p>
* </p>
* @param address string <p>
* The address parameter is either an IPv4 address
* in dotted-quad notation (e.g. 127.0.0.1) if
* socket is AF_INET, a valid
* IPv6 address (e.g. ::1) if IPv6 support is enabled and
* socket is AF_INET6
* or the pathname of a Unix domain socket, if the socket family is
* AF_UNIX.
* </p>
* @param port int[optional] <p>
* The port parameter is only used and is mandatory
* when connecting to an AF_INET or an
* AF_INET6 socket, and designates
* the port on the remote host to which a connection should be made.
* </p>
* @return bool Returns true on success, false on failure. The error code can be retrieved with
* socket_last_error. This code may be passed to
* socket_strerror to get a textual explanation of the
* error.
* </p>
*
* <p>
* If the socket is non-blocking then this function returns false with an
* error Operation now in progress.
*/
function socket_connect ($socket, $address, $port = null) {}
/**
* Return a string describing a socket error
* @link http://www.php.net/manual/en/function.socket-strerror.php
* @param errno int <p>
* A valid socket error number, likely produced by
* socket_last_error.
* </p>
* @return string the error message associated with the errno
* parameter.
*/
function socket_strerror ($errno) {}
/**
* Binds a name to a socket
* @link http://www.php.net/manual/en/function.socket-bind.php
* @param socket resource <p>
* A valid socket resource created with socket_create.
* </p>
* @param address string <p>
* If the socket is of the AF_INET family, the
* address is an IP in dotted-quad notation
* (e.g. 127.0.0.1).
* </p>
* <p>
* If the socket is of the AF_UNIX family, the
* address is the path of a
* Unix-domain socket (e.g. /tmp/my.sock).
* </p>
* @param port int[optional] <p>
* The port parameter is only used when
* binding an AF_INET socket, and designates
* the port on which to listen for connections.
* </p>
* @return bool Returns true on success, false on failure.
* </p>
* <p>
* The error code can be retrieved with socket_last_error.
* This code may be passed to socket_strerror to get a
* textual explanation of the error.
*/
function socket_bind ($socket, $address, $port = null) {}
/**
* Receives data from a connected socket
* @link http://www.php.net/manual/en/function.socket-recv.php
* @param socket resource <p>
* The socket must be a socket resource previously
* created by socket_create().
* </p>
* @param buf string <p>
* The data received will be fetched to the variable specified with
* buf. If an error occurs, if the
* connection is reset, or if no data is
* available, buf will be set to &null;.
* </p>
* @param len int <p>
* Up to len bytes will be fetched from remote host.
* </p>
* @param flags int <p>
* The value of flags can be any combination of
* the following flags, joined with the binary OR (|)
* operator.
* </p>
*
* <table>
* Possible values for flags
*
*
* <tr valign="top">
* <td>Flag</td>
* <td>Description</td>
* </tr>
*
*
* <tr valign="top">
* <td>MSG_OOB</td>
* <td>
* Process out-of-band data.
* </td>
* </tr>
* <tr valign="top">
* <td>MSG_PEEK</td>
* <td>
* Receive data from the beginning of the receive queue without
* removing it from the queue.
* </td>
* </tr>
* <tr valign="top">
* <td>MSG_WAITALL</td>
* <td>
* Block until at least len are received.
* However, if a signal is caught or the remote host disconnects, the
* function may return less data.
* </td>
* </tr>
* <tr valign="top">
* <td>MSG_DONTWAIT</td>
* <td>
* With this flag set, the function returns even if it would normally
* have blocked.
* </td>
* </tr>
*
*
* </table>
* @return int socket_recv returns the number of bytes received,
* or false if there was an error. The actual error code can be retrieved by
* calling socket_last_error. This error code may be
* passed to socket_strerror to get a textual explanation
* of the error.
*/
function socket_recv ($socket, &$buf, $len, $flags) {}
/**
* Sends data to a connected socket
* @link http://www.php.net/manual/en/function.socket-send.php
* @param socket resource <p>
* A valid socket resource created with socket_create
* or socket_accept.
* </p>
* @param buf string <p>
* A buffer containing the data that will be sent to the remote host.
* </p>
* @param len int <p>
* The number of bytes that will be sent to the remote host from
* buf.
* </p>
* @param flags int <p>
* The value of flags can be any combination of
* the following flags, joined with the binary OR (|)
* operator.
* <table>
* Possible values for flags
*
*
* <tr valign="top">
* <td>MSG_OOB</td>
* <td>
* Send OOB (out-of-band) data.
* </td>
* </tr>
* <tr valign="top">
* <td>MSG_EOR</td>
* <td>
* Indicate a record mark. The sent data completes the record.
* </td>
* </tr>
* <tr valign="top">
* <td>MSG_EOF</td>
* <td>
* Close the sender side of the socket and include an appropriate
* notification of this at the end of the sent data. The sent data
* completes the transaction.
* </td>
* </tr>
* <tr valign="top">
* <td>MSG_DONTROUTE</td>
* <td>
* Bypass routing, use direct interface.
* </td>
* </tr>
*
*
* </table>
* </p>
* @return int socket_send returns the number of bytes sent, or false on error.
*/
function socket_send ($socket, $buf, $len, $flags) {}
/**
* Receives data from a socket whether or not it is connection-oriented
* @link http://www.php.net/manual/en/function.socket-recvfrom.php
* @param socket resource <p>
* The socket must be a socket resource previously
* created by socket_create().
* </p>
* @param buf string <p>
* The data received will be fetched to the variable specified with
* buf.
* </p>
* @param len int <p>
* Up to len bytes will be fetched from remote host.
* </p>
* @param flags int <p>
* The value of flags can be any combination of
* the following flags, joined with the binary OR (|)
* operator.
* </p>
*
* <table>
* Possible values for flags
*
*
* <tr valign="top">
* <td>Flag</td>
* <td>Description</td>
* </tr>
*
*
* <tr valign="top">
* <td>MSG_OOB</td>
* <td>
* Process out-of-band data.
* </td>
* </tr>
* <tr valign="top">
* <td>MSG_PEEK</td>
* <td>
* Receive data from the beginning of the receive queue without
* removing it from the queue.
* </td>
* </tr>
* <tr valign="top">
* <td>MSG_WAITALL</td>
* <td>
* Block until at least len are received.
* However, if a signal is caught or the remote host disconnects, the
* function may return less data.
* </td>
* </tr>
* <tr valign="top">
* <td>MSG_DONTWAIT</td>
* <td>
* With this flag set, the function returns even if it would normally
* have blocked.
* </td>
* </tr>
*
*
* </table>
* @param name string <p>
* If the socket is of the type AF_UNIX type,
* name is the path to the file. Else, for
* unconnected sockets, name is the IP address of,
* the remote host, or &null; if the socket is connection-oriented.
* </p>
* @param port int[optional] <p>
* This argument only applies to AF_INET and
* AF_INET6 sockets, and specifies the remote port
* from which the data is received. If the socket is connection-oriented,
* port will be &null;.
* </p>
* @return int socket_recvfrom returns the number of bytes received,
* or false if there was an error. The actual error code can be retrieved by
* calling socket_last_error. This error code may be
* passed to socket_strerror to get a textual explanation
* of the error.
*/
function socket_recvfrom ($socket, &$buf, $len, $flags, &$name, &$port = null) {}
/**
* Sends a message to a socket, whether it is connected or not
* @link http://www.php.net/manual/en/function.socket-sendto.php
* @param socket resource <p>
* A valid socket resource created using socket_create.
* </p>
* @param buf string <p>
* The sent data will be taken from buffer buf.
* </p>
* @param len int <p>
* len bytes from buf will be
* sent.
* </p>
* @param flags int <p>
* The value of flags can be any combination of
* the following flags, joined with the binary OR (|)
* operator.
* <table>
* Possible values for flags
*
*
* <tr valign="top">
* <td>MSG_OOB</td>
* <td>
* Send OOB (out-of-band) data.
* </td>
* </tr>
* <tr valign="top">
* <td>MSG_EOR</td>
* <td>
* Indicate a record mark. The sent data completes the record.
* </td>
* </tr>
* <tr valign="top">
* <td>MSG_EOF</td>
* <td>
* Close the sender side of the socket and include an appropriate
* notification of this at the end of the sent data. The sent data
* completes the transaction.
* </td>
* </tr>
* <tr valign="top">
* <td>MSG_DONTROUTE</td>
* <td>
* Bypass routing, use direct interface.
* </td>
* </tr>
*
*
* </table>
* </p>
* @param addr string <p>
* IP address of the remote host.
* </p>
* @param port int[optional] <p>
* port is the remote port number at which the data
* will be sent.
* </p>
* @return int socket_sendto returns the number of bytes sent to the
* remote host, or false if an error occurred.
*/
function socket_sendto ($socket, $buf, $len, $flags, $addr, $port = null) {}
/**
* Gets socket options for the socket
* @link http://www.php.net/manual/en/function.socket-get-option.php
* @param socket resource <p>
* A valid socket resource created with socket_create
* or socket_accept.
* </p>
* @param level int <p>
* The level parameter specifies the protocol
* level at which the option resides. For example, to retrieve options at
* the socket level, a level parameter of
* SOL_SOCKET would be used. Other levels, such as
* TCP, can be used by
* specifying the protocol number of that level. Protocol numbers can be
* found by using the getprotobyname function.
* </p>
* @param optname int <table>
* Available Socket Options
*
*
* <tr valign="top">
* <td>Option</td>
* <td>Description</td>
* <td>Type</td>
* </tr>
*
*
* <tr valign="top">
* <td>SO_DEBUG</td>
* <td>
* Reports whether debugging information is being recorded.
* </td>
* <td>
* int
* </td>
* </tr>
* <tr valign="top">
* <td>SO_BROADCAST</td>
* <td>
* Reports whether transmission of broadcast messages is supported.
* </td>
* <td>
* int
* </td>
* </tr>
* <tr valign="top">
* <td>SO_REUSEADDR</td>
* <td>
* Reports whether local addresses can be reused.
* </td>
* <td>
* int
* </td>
* </tr>
* <tr valign="top">
* <td>SO_KEEPALIVE</td>
* <td>
* Reports whether connections are kept active with periodic transmission
* of messages. If the connected socket fails to respond to these messages,
* the connection is broken and processes writing to that socket are notified
* with a SIGPIPE signal.
* </td>
* <td>
* int
* </td>
* </tr>
* <tr valign="top">
* <td>SO_LINGER</td>
* <td>
* <p>
* Reports whether the socket lingers on
* socket_close if data is present. By default,
* when the socket is closed, it attempts to send all unsent data.
* In the case of a connection-oriented socket,
* socket_close will wait for its peer to
* acknowledge the data.
* </p>
* <p>
* If l_onoff is non-zero and
* l_linger is zero, all the
* unsent data will be discarded and RST (reset) is sent to the
* peer in the case of a connection-oriented socket.
* </p>
* <p>
* On the other hand, if l_onoff is
* non-zero and l_linger is non-zero,
* socket_close will block until all the data
* is sent or the time specified in l_linger
* elapses. If the socket is non-blocking,
* socket_close will fail and return an error.
* </p>
* </td>
* <td>
* array. The array will contain two keys:
* l_onoff and
* l_linger.
* </td>
* </tr>
* <tr valign="top">
* <td>SO_OOBINLINE</td>
* <td>
* Reports whether the socket leaves out-of-band data inline.
* </td>
* <td>
* int
* </td>
* </tr>
* <tr valign="top">
* <td>SO_SNDBUF</td>
* <td>
* Reports the size of the send buffer.
* </td>
* <td>
* int
* </td>
* </tr>
* <tr valign="top">
* <td>SO_RCVBUF</td>
* <td>
* Reports the size of the receive buffer.
* </td>
* <td>
* int
* </td>
* </tr>
* <tr valign="top">
* <td>SO_ERROR</td>
* <td>
* Reports information about error status and clears it.
* </td>
* <td>
* int (cannot be set by socket_set_option)
* </td>
* </tr>
* <tr valign="top">
* <td>SO_TYPE</td>
* <td>
* Reports the socket type (e.g.
* SOCK_STREAM).
* </td>
* <td>
* int (cannot be set by socket_set_option)
* </td>
* </tr>
* <tr valign="top">
* <td>SO_DONTROUTE</td>
* <td>
* Reports whether outgoing messages bypass the standard routing facilities.
* </td>
* <td>
* int
* </td>
* </tr>
* <tr valign="top">
* <td>SO_RCVLOWAT</td>
* <td>
* Reports the minimum number of bytes to process for socket
* input operations.
* </td>
* <td>
* int
* </td>
* </tr>
* <tr valign="top">
* <td>SO_RCVTIMEO</td>
* <td>
* Reports the timeout value for input operations.
* </td>
* <td>
* array. The array will contain two keys:
* sec which is the seconds part on the timeout
* value and usec which is the microsecond part
* of the timeout value.
* </td>
* </tr>
* <tr valign="top">
* <td>SO_SNDTIMEO</td>
* <td>
* Reports the timeout value specifying the amount of time that an output
* function blocks because flow control prevents data from being sent.
* </td>
* <td>
* array. The array will contain two keys:
* sec which is the seconds part on the timeout
* value and usec which is the microsecond part
* of the timeout value.
* </td>
* </tr>
* <tr valign="top">
* <td>SO_SNDLOWAT</td>
* <td>
* Reports the minimum number of bytes to process for socket output operations.
* </td>
* <td>
* int
* </td>
* </tr>
* <tr valign="top">
* <td>TCP_NODELAY</td>
* <td>
* Reports whether the Nagle TCP algorithm is disabled.
* </td>
* <td>
* int
* </td>
* </tr>
* <tr valign="top">
* <td>MCAST_JOIN_GROUP</td>
* <td>
* Joins a multicast group. (added in PHP 5.4)
* </td>
* <td>
* array with keys "group", specifying
* a string with an IPv4 or IPv6 multicast address and
* "interface", specifying either an interface
* number (type int) or a string with
* the interface name, like "eth0".
* 0 can be specified to indicate the interface
* should be selected using routing rules. (can only be used in
* socket_set_option)
* </td>
* </tr>
* <tr valign="top">
* <td>MCAST_LEAVE_GROUP</td>
* <td>
* Leaves a multicast group. (added in PHP 5.4)
* </td>
* <td>
* array. See MCAST_JOIN_GROUP for
* more information. (can only be used in
* socket_set_option)
* </td>
* </tr>
* <tr valign="top">
* <td>MCAST_BLOCK_SOURCE</td>
* <td>
* Blocks packets arriving from a specific source to a specific
* multicast group, which must have been previously joined.
* (added in PHP 5.4)
* </td>
* <td>
* array with the same keys as
* MCAST_JOIN_GROUP, plus one extra key,
* source, which maps to a string
* specifying an IPv4 or IPv6 address of the source to be blocked.
* (can only be used in socket_set_option)
* </td>
* </tr>
* <tr valign="top">
* <td>MCAST_UNBLOCK_SOURCE</td>
* <td>
* Unblocks (start receiving again) packets arriving from a specific
* source address to a specific multicast group, which must have been
* previously joined. (added in PHP 5.4)
* </td>
* <td>
* array with the same format as
* MCAST_BLOCK_SOURCE.
* (can only be used in socket_set_option)
* </td>
* </tr>
* <tr valign="top">
* <td>MCAST_JOIN_SOURCE_GROUP</td>
* <td>
* Receive packets destined to a specific multicast group whose source
* address matches a specific value. (added in PHP 5.4)
* </td>
* <td>
* array with the same format as
* MCAST_BLOCK_SOURCE.
* (can only be used in socket_set_option)
* </td>
* </tr>
* <tr valign="top">
* <td>MCAST_LEAVE_SOURCE_GROUP</td>
* <td>
* Stop receiving packets destined to a specific multicast group whose
* soure address matches a specific value. (added in PHP 5.4)
* </td>
* <td>
* array with the same format as
* MCAST_BLOCK_SOURCE.
* (can only be used in socket_set_option)
* </td>
* </tr>
* <tr valign="top">
* <td>IP_MULTICAST_IF</td>
* <td>
* The outgoing interface for IPv4 multicast packets.
* (added in PHP 5.4)
* </td>
* <td>
* Either int specifying the interface number or a
* string with an interface name, like
* eth0. The value 0 can be used to
* indicate the routing table is to used in the interface selection.
* The function socket_get_option returns an
* interface index.
* Note that, unlike the C API, this option does NOT take an IP
* address. This eliminates the interface difference between
* IP_MULTICAST_IF and
* IPV6_MULTICAST_IF.
* </td>
* </tr>
* <tr valign="top">
* <td>IPV6_MULTICAST_IF</td>
* <td>
* The outgoing interface for IPv6 multicast packets.
* (added in PHP 5.4)
* </td>
* <td>
* The same as IP_MULTICAST_IF.
* </td>
* </tr>
* <tr valign="top">
* <td>IP_MULTICAST_LOOP</td>
* <td>
* The multicast loopback policy for IPv4 packets, which
* determines whether multicast packets sent by this socket also reach
* receivers in the same host that have joined the same multicast group
* on the outgoing interface used by this socket. This is the case by
* default.
* (added in PHP 5.4)
* </td>
* <td>
* int (either 0 or
* 1). For socket_set_option
* any value will be accepted and will be converted to a boolean
* following the usual PHP rules.
* </td>
* </tr>
* <tr valign="top">
* <td>IPV6_MULTICAST_LOOP</td>
* <td>
* Analogous to IP_MULTICAST_LOOP, but for IPv6.
* (added in PHP 5.4)
* </td>
* <td>
* int. See IP_MULTICAST_LOOP.
* </td>
* </tr>
* <tr valign="top">
* <td>IP_MULTICAST_TTL</td>
* <td>
* The time-to-live of outgoing IPv4 multicast packets. This should be
* a value between 0 (don't leave the interface) and 255. The default
* value is 1 (only the local network is reached).
* (added in PHP 5.4)
* </td>
* <td>
* int between 0 and 255.
* </td>
* </tr>
* <tr valign="top">
* <td>IPV6_MULTICAST_HOPS</td>
* <td>
* Analogous to IP_MULTICAST_TTL, but for IPv6
* packets. The value -1 is also accepted, meaning the route default
* should be used.
* (added in PHP 5.4)
* </td>
* <td>
* int between -1 and 255.
* </td>
* </tr>
*
*
* </table>
* @return mixed the value of the given option, or false on errors.
*/
function socket_get_option ($socket, $level, $optname) {}
/**
* Sets socket options for the socket
* @link http://www.php.net/manual/en/function.socket-set-option.php
* @param socket resource <p>
* A valid socket resource created with socket_create
* or socket_accept.
* </p>
* @param level int <p>
* The level parameter specifies the protocol
* level at which the option resides. For example, to retrieve options at
* the socket level, a level parameter of
* SOL_SOCKET would be used. Other levels, such as
* TCP, can be used by specifying the protocol number of that level.
* Protocol numbers can be found by using the
* getprotobyname function.
* </p>
* @param optname int <p>
* The available socket options are the same as those for the
* socket_get_option function.
* </p>
* @param optval mixed <p>
* The option value.
* </p>
* @return bool Returns true on success, false on failure.
*/
function socket_set_option ($socket, $level, $optname, $optval) {}
/**
* Shuts down a socket for receiving, sending, or both
* @link http://www.php.net/manual/en/function.socket-shutdown.php
* @param socket resource <p>
* A valid socket resource created with socket_create.
* </p>
* @param how int[optional] <p>
* The value of how can be one of the following:
* <table>
* possible values for how
*
*
* <tr valign="top">
* <td>0</td>
* <td>
* Shutdown socket reading
* </td>
* </tr>
* <tr valign="top">
* <td>1</td>
* <td>
* Shutdown socket writing
* </td>
* </tr>
* <tr valign="top">
* <td>2</td>
* <td>
* Shutdown socket reading and writing
* </td>
* </tr>
*
*
* </table>
* </p>
* @return bool Returns true on success, false on failure.
*/
function socket_shutdown ($socket, $how = null) {}
/**
* Returns the last error on the socket
* @link http://www.php.net/manual/en/function.socket-last-error.php
* @param socket resource[optional] <p>
* A valid socket resource created with socket_create.
* </p>
* @return int This function returns a socket error code.
*/
function socket_last_error ($socket = null) {}
/**
* Clears the error on the socket or the last error code
* @link http://www.php.net/manual/en/function.socket-clear-error.php
* @param socket resource[optional] <p>
* A valid socket resource created with socket_create.
* </p>
* @return void
*/
function socket_clear_error ($socket = null) {}
/**
* Import a stream
* @link http://www.php.net/manual/en/function.socket-import-stream.php
* @param stream resource <p>
* The stream resource to import.
* </p>
* @return resource false or &null; on failure.
*/
function socket_import_stream ($stream) {}
/**
* Send a message
* @link http://www.php.net/manual/en/function.socket-sendmsg.php
* @param socket resource <p>
* </p>
* @param message array <p>
* </p>
* @param flags int <p>
* </p>
* @return int
*/
function socket_sendmsg ($socket, array $message, $flags) {}
/**
* Read a message
* @link http://www.php.net/manual/en/function.socket-recvmsg.php
* @param socket resource <p>
* </p>
* @param message string <p>
* </p>
* @param flags int[optional] <p>
* </p>
* @return int
*/
function socket_recvmsg ($socket, $message, $flags = null) {}
/**
* Calculate message buffer size
* @link http://www.php.net/manual/en/function.socket-cmsg-space.php
* @param level int <p>
* </p>
* @param type int <p>
* </p>
* @return int
*/
function socket_cmsg_space ($level, $type) {}
/**
* @param socket
* @param level
* @param optname
*/
function socket_getopt ($socket, $level, $optname) {}
/**
* @param socket
* @param level
* @param optname
* @param optval
*/
function socket_setopt ($socket, $level, $optname, $optval) {}
define ('AF_UNIX', 1);
define ('AF_INET', 2);
/**
* Only available if compiled with IPv6 support.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('AF_INET6', 10);
define ('SOCK_STREAM', 1);
define ('SOCK_DGRAM', 2);
define ('SOCK_RAW', 3);
define ('SOCK_SEQPACKET', 5);
define ('SOCK_RDM', 4);
define ('MSG_OOB', 1);
define ('MSG_WAITALL', 256);
define ('MSG_CTRUNC', 8);
define ('MSG_TRUNC', 32);
define ('MSG_PEEK', 2);
define ('MSG_DONTROUTE', 4);
/**
* Not available on Windows platforms.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('MSG_EOR', 128);
/**
* Not available on Windows platforms.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('MSG_EOF', 512);
define ('MSG_CONFIRM', 2048);
define ('MSG_ERRQUEUE', 8192);
define ('MSG_NOSIGNAL', 16384);
define ('MSG_DONTWAIT', 64);
define ('MSG_MORE', 32768);
define ('MSG_CMSG_CLOEXEC', 1073741824);
define ('SO_DEBUG', 1);
define ('SO_REUSEADDR', 2);
define ('SO_KEEPALIVE', 9);
define ('SO_DONTROUTE', 5);
define ('SO_LINGER', 13);
define ('SO_BROADCAST', 6);
define ('SO_OOBINLINE', 10);
define ('SO_SNDBUF', 7);
define ('SO_RCVBUF', 8);
define ('SO_SNDLOWAT', 19);
define ('SO_RCVLOWAT', 18);
define ('SO_SNDTIMEO', 21);
define ('SO_RCVTIMEO', 20);
define ('SO_TYPE', 3);
define ('SO_ERROR', 4);
define ('SO_BINDTODEVICE', 25);
define ('SOL_SOCKET', 1);
define ('SOMAXCONN', 128);
/**
* Used to disable Nagle TCP algorithm.
* Added in PHP 5.2.7.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('TCP_NODELAY', 1);
define ('PHP_NORMAL_READ', 1);
define ('PHP_BINARY_READ', 2);
define ('MCAST_JOIN_GROUP', 42);
define ('MCAST_LEAVE_GROUP', 45);
define ('MCAST_BLOCK_SOURCE', 43);
define ('MCAST_UNBLOCK_SOURCE', 44);
define ('MCAST_JOIN_SOURCE_GROUP', 46);
define ('MCAST_LEAVE_SOURCE_GROUP', 47);
define ('IP_MULTICAST_IF', 32);
define ('IP_MULTICAST_TTL', 33);
define ('IP_MULTICAST_LOOP', 34);
define ('IPV6_MULTICAST_IF', 17);
define ('IPV6_MULTICAST_HOPS', 18);
define ('IPV6_MULTICAST_LOOP', 19);
/**
* Operation not permitted.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EPERM', 1);
/**
* No such file or directory.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOENT', 2);
/**
* Interrupted system call.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EINTR', 4);
/**
* I/O error.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EIO', 5);
/**
* No such device or address.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENXIO', 6);
/**
* Arg list too long.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_E2BIG', 7);
/**
* Bad file number.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EBADF', 9);
/**
* Try again.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EAGAIN', 11);
/**
* Out of memory.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOMEM', 12);
/**
* Permission denied.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EACCES', 13);
/**
* Bad address.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EFAULT', 14);
/**
* Block device required.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOTBLK', 15);
/**
* Device or resource busy.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EBUSY', 16);
/**
* File exists.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EEXIST', 17);
/**
* Cross-device link.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EXDEV', 18);
/**
* No such device.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENODEV', 19);
/**
* Not a directory.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOTDIR', 20);
/**
* Is a directory.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EISDIR', 21);
/**
* Invalid argument.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EINVAL', 22);
/**
* File table overflow.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENFILE', 23);
/**
* Too many open files.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EMFILE', 24);
/**
* Not a typewriter.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOTTY', 25);
/**
* No space left on device.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOSPC', 28);
/**
* Illegal seek.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ESPIPE', 29);
/**
* Read-only file system.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EROFS', 30);
/**
* Too many links.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EMLINK', 31);
/**
* Broken pipe.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EPIPE', 32);
/**
* File name too long.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENAMETOOLONG', 36);
/**
* No record locks available.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOLCK', 37);
/**
* Function not implemented.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOSYS', 38);
/**
* Directory not empty.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOTEMPTY', 39);
/**
* Too many symbolic links encountered.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ELOOP', 40);
/**
* Operation would block.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EWOULDBLOCK', 11);
/**
* No message of desired type.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOMSG', 42);
/**
* Identifier removed.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EIDRM', 43);
/**
* Channel number out of range.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ECHRNG', 44);
/**
* Level 2 not synchronized.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EL2NSYNC', 45);
/**
* Level 3 halted.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EL3HLT', 46);
/**
* Level 3 reset.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EL3RST', 47);
/**
* Link number out of range.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ELNRNG', 48);
/**
* Protocol driver not attached.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EUNATCH', 49);
/**
* No CSI structure available.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOCSI', 50);
/**
* Level 2 halted.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EL2HLT', 51);
/**
* Invalid exchange.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EBADE', 52);
/**
* Invalid request descriptor.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EBADR', 53);
/**
* Exchange full.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EXFULL', 54);
/**
* No anode.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOANO', 55);
/**
* Invalid request code.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EBADRQC', 56);
/**
* Invalid slot.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EBADSLT', 57);
/**
* Device not a stream.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOSTR', 60);
/**
* No data available.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENODATA', 61);
/**
* Timer expired.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ETIME', 62);
/**
* Out of streams resources.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOSR', 63);
/**
* Machine is not on the network.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENONET', 64);
/**
* Object is remote.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EREMOTE', 66);
/**
* Link has been severed.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOLINK', 67);
/**
* Advertise error.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EADV', 68);
/**
* Srmount error.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ESRMNT', 69);
/**
* Communication error on send.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ECOMM', 70);
/**
* Protocol error.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EPROTO', 71);
/**
* Multihop attempted.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EMULTIHOP', 72);
/**
* Not a data message.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EBADMSG', 74);
/**
* Name not unique on network.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOTUNIQ', 76);
/**
* File descriptor in bad state.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EBADFD', 77);
/**
* Remote address changed.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EREMCHG', 78);
/**
* Interrupted system call should be restarted.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ERESTART', 85);
/**
* Streams pipe error.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ESTRPIPE', 86);
/**
* Too many users.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EUSERS', 87);
/**
* Socket operation on non-socket.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOTSOCK', 88);
/**
* Destination address required.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EDESTADDRREQ', 89);
/**
* Message too long.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EMSGSIZE', 90);
/**
* Protocol wrong type for socket.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EPROTOTYPE', 91);
define ('SOCKET_ENOPROTOOPT', 92);
/**
* Protocol not supported.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EPROTONOSUPPORT', 93);
/**
* Socket type not supported.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ESOCKTNOSUPPORT', 94);
/**
* Operation not supported on transport endpoint.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EOPNOTSUPP', 95);
/**
* Protocol family not supported.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EPFNOSUPPORT', 96);
/**
* Address family not supported by protocol.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EAFNOSUPPORT', 97);
define ('SOCKET_EADDRINUSE', 98);
/**
* Cannot assign requested address.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EADDRNOTAVAIL', 99);
/**
* Network is down.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENETDOWN', 100);
/**
* Network is unreachable.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENETUNREACH', 101);
/**
* Network dropped connection because of reset.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENETRESET', 102);
/**
* Software caused connection abort.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ECONNABORTED', 103);
/**
* Connection reset by peer.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ECONNRESET', 104);
/**
* No buffer space available.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOBUFS', 105);
/**
* Transport endpoint is already connected.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EISCONN', 106);
/**
* Transport endpoint is not connected.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOTCONN', 107);
/**
* Cannot send after transport endpoint shutdown.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ESHUTDOWN', 108);
/**
* Too many references: cannot splice.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ETOOMANYREFS', 109);
/**
* Connection timed out.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ETIMEDOUT', 110);
/**
* Connection refused.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ECONNREFUSED', 111);
/**
* Host is down.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EHOSTDOWN', 112);
/**
* No route to host.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EHOSTUNREACH', 113);
/**
* Operation already in progress.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EALREADY', 114);
/**
* Operation now in progress.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EINPROGRESS', 115);
/**
* Is a named type file.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EISNAM', 120);
/**
* Remote I/O error.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EREMOTEIO', 121);
/**
* Quota exceeded.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EDQUOT', 122);
/**
* No medium found.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_ENOMEDIUM', 123);
/**
* Wrong medium type.
* @link http://www.php.net/manual/en/sockets.constants.php
*/
define ('SOCKET_EMEDIUMTYPE', 124);
define ('IPPROTO_IP', 0);
define ('IPPROTO_IPV6', 41);
define ('SOL_TCP', 6);
define ('SOL_UDP', 17);
define ('IPV6_UNICAST_HOPS', 16);
define ('IPV6_RECVPKTINFO', 49);
define ('IPV6_PKTINFO', 50);
define ('IPV6_RECVHOPLIMIT', 51);
define ('IPV6_HOPLIMIT', 52);
define ('IPV6_RECVTCLASS', 66);
define ('IPV6_TCLASS', 67);
define ('SCM_RIGHTS', 1);
define ('SCM_CREDENTIALS', 2);
define ('SO_PASSCRED', 16);
// End of sockets v.
?>
|