PageRenderTime 27ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/.metadata/.plugins/org.eclipse.php.core/__language__/a601fd1b/sockets.php

https://github.com/sad1990/--
PHP | 1370 lines | 129 code | 34 blank | 1207 comment | 0 complexity | ccfc3c436fdb4f6ae3d76d20e9f0920b MD5 | raw file
Possible License(s): CC-BY-3.0, GPL-2.0, Apache-2.0
  1. <?php
  2. // Start of sockets v.
  3. /**
  4. * Runs the select() system call on the given arrays of sockets with a specified timeout
  5. * @link http://www.php.net/manual/en/function.socket-select.php
  6. * @param read array <p>
  7. * The sockets listed in the read array will be
  8. * watched to see if characters become available for reading (more
  9. * precisely, to see if a read will not block - in particular, a socket
  10. * resource is also ready on end-of-file, in which case a
  11. * socket_read will return a zero length string).
  12. * </p>
  13. * @param write array <p>
  14. * The sockets listed in the write array will be
  15. * watched to see if a write will not block.
  16. * </p>
  17. * @param except array <p>
  18. * The sockets listed in the except array will be
  19. * watched for exceptions.
  20. * </p>
  21. * @param tv_sec int <p>
  22. * The tv_sec and tv_usec
  23. * together form the timeout parameter. The
  24. * timeout is an upper bound on the amount of time
  25. * elapsed before socket_select return.
  26. * tv_sec may be zero , causing
  27. * socket_select to return immediately. This is useful
  28. * for polling. If tv_sec is &null; (no timeout),
  29. * socket_select can block indefinitely.
  30. * </p>
  31. * @param tv_usec int[optional] <p>
  32. * </p>
  33. * @return int On success socket_select returns the number of
  34. * socket resources contained in the modified arrays, which may be zero if
  35. * the timeout expires before anything interesting happens. On error false
  36. * is returned. The error code can be retrieved with
  37. * socket_last_error.
  38. * </p>
  39. * <p>
  40. * Be sure to use the === operator when checking for an
  41. * error. Since the socket_select may return 0 the
  42. * comparison with == would evaluate to true:
  43. * Understanding socket_select's result
  44. * ]]>
  45. */
  46. function socket_select (array &$read, array &$write, array &$except, $tv_sec, $tv_usec = null) {}
  47. /**
  48. * Create a socket (endpoint for communication)
  49. * @link http://www.php.net/manual/en/function.socket-create.php
  50. * @param domain int <p>
  51. * The domain parameter specifies the protocol
  52. * family to be used by the socket.
  53. * </p>
  54. * <table>
  55. * Available address/protocol families
  56. * <tr valign="top">
  57. * <td>Domain</td>
  58. * <td>Description</td>
  59. * </tr>
  60. * <tr valign="top">
  61. * <td>AF_INET</td>
  62. * <td>
  63. * IPv4 Internet based protocols. TCP and UDP are common protocols of
  64. * this protocol family.
  65. * </td>
  66. * </tr>
  67. * <tr valign="top">
  68. * <td>AF_INET6</td>
  69. * <td>
  70. * IPv6 Internet based protocols. TCP and UDP are common protocols of
  71. * this protocol family.
  72. * </td>
  73. * </tr>
  74. * <tr valign="top">
  75. * <td>AF_UNIX</td>
  76. * <td>
  77. * Local communication protocol family. High efficiency and low
  78. * overhead make it a great form of IPC (Interprocess Communication).
  79. * </td>
  80. * </tr>
  81. * </table>
  82. * @param type int <p>
  83. * The type parameter selects the type of communication
  84. * to be used by the socket.
  85. * </p>
  86. * <table>
  87. * Available socket types
  88. * <tr valign="top">
  89. * <td>Type</td>
  90. * <td>Description</td>
  91. * </tr>
  92. * <tr valign="top">
  93. * <td>SOCK_STREAM</td>
  94. * <td>
  95. * Provides sequenced, reliable, full-duplex, connection-based byte streams.
  96. * An out-of-band data transmission mechanism may be supported.
  97. * The TCP protocol is based on this socket type.
  98. * </td>
  99. * </tr>
  100. * <tr valign="top">
  101. * <td>SOCK_DGRAM</td>
  102. * <td>
  103. * Supports datagrams (connectionless, unreliable messages of a fixed maximum length).
  104. * The UDP protocol is based on this socket type.
  105. * </td>
  106. * </tr>
  107. * <tr valign="top">
  108. * <td>SOCK_SEQPACKET</td>
  109. * <td>
  110. * Provides a sequenced, reliable, two-way connection-based data transmission path for
  111. * datagrams of fixed maximum length; a consumer is required to read an
  112. * entire packet with each read call.
  113. * </td>
  114. * </tr>
  115. * <tr valign="top">
  116. * <td>SOCK_RAW</td>
  117. * <td>
  118. * Provides raw network protocol access. This special type of socket
  119. * can be used to manually construct any type of protocol. A common use
  120. * for this socket type is to perform ICMP requests (like ping).
  121. * </td>
  122. * </tr>
  123. * <tr valign="top">
  124. * <td>SOCK_RDM</td>
  125. * <td>
  126. * Provides a reliable datagram layer that does not guarantee ordering.
  127. * This is most likely not implemented on your operating system.
  128. * </td>
  129. * </tr>
  130. * </table>
  131. * @param protocol int <p>
  132. * The protocol parameter sets the specific
  133. * protocol within the specified domain to be used
  134. * when communicating on the returned socket. The proper value can be
  135. * retrieved by name by using getprotobyname. If
  136. * the desired protocol is TCP, or UDP the corresponding constants
  137. * SOL_TCP, and SOL_UDP
  138. * can also be used.
  139. * </p>
  140. * <table>
  141. * Common protocols
  142. * <tr valign="top">
  143. * <td>Name</td>
  144. * <td>Description</td>
  145. * </tr>
  146. * <tr valign="top">
  147. * <td>icmp</td>
  148. * <td>
  149. * The Internet Control Message Protocol is used primarily by gateways
  150. * and hosts to report errors in datagram communication. The "ping"
  151. * command (present in most modern operating systems) is an example
  152. * application of ICMP.
  153. * </td>
  154. * </tr>
  155. * <tr valign="top">
  156. * <td>udp</td>
  157. * <td>
  158. * The User Datagram Protocol is a connectionless, unreliable,
  159. * protocol with fixed record lengths. Due to these aspects, UDP
  160. * requires a minimum amount of protocol overhead.
  161. * </td>
  162. * </tr>
  163. * <tr valign="top">
  164. * <td>tcp</td>
  165. * <td>
  166. * The Transmission Control Protocol is a reliable, connection based,
  167. * stream oriented, full duplex protocol. TCP guarantees that all data packets
  168. * will be received in the order in which they were sent. If any packet is somehow
  169. * lost during communication, TCP will automatically retransmit the packet until
  170. * the destination host acknowledges that packet. For reliability and performance
  171. * reasons, the TCP implementation itself decides the appropriate octet boundaries
  172. * of the underlying datagram communication layer. Therefore, TCP applications must
  173. * allow for the possibility of partial record transmission.
  174. * </td>
  175. * </tr>
  176. * </table>
  177. * @return resource socket_create returns a socket resource on success,
  178. * or false on error. The actual error code can be retrieved by calling
  179. * socket_last_error. This error code may be passed to
  180. * socket_strerror to get a textual explanation of the
  181. * error.
  182. */
  183. function socket_create ($domain, $type, $protocol) {}
  184. /**
  185. * Opens a socket on port to accept connections
  186. * @link http://www.php.net/manual/en/function.socket-create-listen.php
  187. * @param port int <p>
  188. * The port on which to listen on all interfaces.
  189. * </p>
  190. * @param backlog int[optional] <p>
  191. * The backlog parameter defines the maximum length
  192. * the queue of pending connections may grow to.
  193. * SOMAXCONN may be passed as
  194. * backlog parameter, see
  195. * socket_listen for more information.
  196. * </p>
  197. * @return resource socket_create_listen returns a new socket resource
  198. * on success or false on error. The error code can be retrieved with
  199. * socket_last_error. This code may be passed to
  200. * socket_strerror to get a textual explanation of the
  201. * error.
  202. */
  203. function socket_create_listen ($port, $backlog = null) {}
  204. /**
  205. * Creates a pair of indistinguishable sockets and stores them in an array
  206. * @link http://www.php.net/manual/en/function.socket-create-pair.php
  207. * @param domain int <p>
  208. * The domain parameter specifies the protocol
  209. * family to be used by the socket. See socket_create
  210. * for the full list.
  211. * </p>
  212. * @param type int <p>
  213. * The type parameter selects the type of communication
  214. * to be used by the socket. See socket_create for the
  215. * full list.
  216. * </p>
  217. * @param protocol int <p>
  218. * The protocol parameter sets the specific
  219. * protocol within the specified domain to be used
  220. * when communicating on the returned socket. The proper value can be retrieved by
  221. * name by using getprotobyname. If
  222. * the desired protocol is TCP, or UDP the corresponding constants
  223. * SOL_TCP, and SOL_UDP
  224. * can also be used.
  225. * </p>
  226. * <p>
  227. * See socket_create for the full list of supported
  228. * protocols.
  229. * </p>
  230. * @param fd array <p>
  231. * Reference to an array in which the two socket resources will be inserted.
  232. * </p>
  233. * @return bool Returns true on success or false on failure.
  234. */
  235. function socket_create_pair ($domain, $type, $protocol, array &$fd) {}
  236. /**
  237. * Accepts a connection on a socket
  238. * @link http://www.php.net/manual/en/function.socket-accept.php
  239. * @param socket resource <p>
  240. * A valid socket resource created with socket_create.
  241. * </p>
  242. * @return resource a new socket resource on success, or false on error. The actual
  243. * error code can be retrieved by calling
  244. * socket_last_error. This error code may be passed to
  245. * socket_strerror to get a textual explanation of the
  246. * error.
  247. */
  248. function socket_accept ($socket) {}
  249. /**
  250. * Sets nonblocking mode for file descriptor fd
  251. * @link http://www.php.net/manual/en/function.socket-set-nonblock.php
  252. * @param socket resource <p>
  253. * A valid socket resource created with socket_create
  254. * or socket_accept.
  255. * </p>
  256. * @return bool Returns true on success or false on failure.
  257. */
  258. function socket_set_nonblock ($socket) {}
  259. /**
  260. * Sets blocking mode on a socket resource
  261. * @link http://www.php.net/manual/en/function.socket-set-block.php
  262. * @param socket resource <p>
  263. * A valid socket resource created with socket_create
  264. * or socket_accept.
  265. * </p>
  266. * @return bool Returns true on success or false on failure.
  267. */
  268. function socket_set_block ($socket) {}
  269. /**
  270. * Listens for a connection on a socket
  271. * @link http://www.php.net/manual/en/function.socket-listen.php
  272. * @param socket resource <p>
  273. * A valid socket resource created with socket_create.
  274. * </p>
  275. * @param backlog int[optional] <p>
  276. * A maximum of backlog incoming connections will be
  277. * queued for processing. If a connection request arrives with the queue
  278. * full the client may receive an error with an indication of
  279. * ECONNREFUSED, or, if the underlying protocol supports
  280. * retransmission, the request may be ignored so that retries may succeed.
  281. * </p>
  282. * <p>
  283. * The maximum number passed to the backlog
  284. * parameter highly depends on the underlying platform. On Linux, it is
  285. * silently truncated to SOMAXCONN. On win32, if
  286. * passed SOMAXCONN, the underlying service provider
  287. * responsible for the socket will set the backlog to a maximum
  288. * reasonable value. There is no standard provision to
  289. * find out the actual backlog value on this platform.
  290. * </p>
  291. * @return bool Returns true on success or false on failure. The error code can be retrieved with
  292. * socket_last_error. This code may be passed to
  293. * socket_strerror to get a textual explanation of the
  294. * error.
  295. */
  296. function socket_listen ($socket, $backlog = null) {}
  297. /**
  298. * Closes a socket resource
  299. * @link http://www.php.net/manual/en/function.socket-close.php
  300. * @param socket resource <p>
  301. * A valid socket resource created with socket_create
  302. * or socket_accept.
  303. * </p>
  304. * @return void
  305. */
  306. function socket_close ($socket) {}
  307. /**
  308. * Write to a socket
  309. * @link http://www.php.net/manual/en/function.socket-write.php
  310. * @param socket resource <p>
  311. * </p>
  312. * @param buffer string <p>
  313. * The buffer to be written.
  314. * </p>
  315. * @param length int[optional] <p>
  316. * The optional parameter length can specify an
  317. * alternate length of bytes written to the socket. If this length is
  318. * greater than the buffer length, it is silently truncated to the length
  319. * of the buffer.
  320. * </p>
  321. * @return int the number of bytes successfully written to the socket&return.falseforfailure;.
  322. * The error code can be retrieved with
  323. * socket_last_error. This code may be passed to
  324. * socket_strerror to get a textual explanation of the
  325. * error.
  326. * </p>
  327. * <p>
  328. * It is perfectly valid for socket_write to
  329. * return zero which means no bytes have been written. Be sure to use the
  330. * === operator to check for false in case of an
  331. * error.
  332. */
  333. function socket_write ($socket, $buffer, $length = null) {}
  334. /**
  335. * Reads a maximum of length bytes from a socket
  336. * @link http://www.php.net/manual/en/function.socket-read.php
  337. * @param socket resource <p>
  338. * A valid socket resource created with socket_create
  339. * or socket_accept.
  340. * </p>
  341. * @param length int <p>
  342. * The maximum number of bytes read is specified by the
  343. * length parameter. Otherwise you can use
  344. * &#92;r, &#92;n,
  345. * or &#92;0 to end reading (depending on the type
  346. * parameter, see below).
  347. * </p>
  348. * @param type int[optional] <p>
  349. * Optional type parameter is a named constant:
  350. * PHP_BINARY_READ (Default) - use the system
  351. * recv() function. Safe for reading binary data.
  352. * @return string socket_read returns the data as a string on success,
  353. * or false on error (including if the remote host has closed the
  354. * connection). The error code can be retrieved with
  355. * socket_last_error. This code may be passed to
  356. * socket_strerror to get a textual representation of
  357. * the error.
  358. * </p>
  359. * <p>
  360. * socket_read returns a zero length string ("")
  361. * when there is no more data to read.
  362. */
  363. function socket_read ($socket, $length, $type = null) {}
  364. /**
  365. * 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
  366. * @link http://www.php.net/manual/en/function.socket-getsockname.php
  367. * @param socket resource <p>
  368. * A valid socket resource created with socket_create
  369. * or socket_accept.
  370. * </p>
  371. * @param addr string <p>
  372. * If the given socket is of type AF_INET
  373. * or AF_INET6, socket_getsockname
  374. * will return the local IP address in appropriate notation (e.g.
  375. * 127.0.0.1 or fe80::1) in the
  376. * address parameter and, if the optional
  377. * port parameter is present, also the associated port.
  378. * </p>
  379. * <p>
  380. * If the given socket is of type AF_UNIX,
  381. * socket_getsockname will return the Unix filesystem
  382. * path (e.g. /var/run/daemon.sock) in the
  383. * address parameter.
  384. * </p>
  385. * @param port int[optional] <p>
  386. * If provided, this will hold the associated port.
  387. * </p>
  388. * @return bool Returns true on success or false on failure. socket_getsockname may also return
  389. * false if the socket type is not any of AF_INET,
  390. * AF_INET6, or AF_UNIX, in which
  391. * case the last socket error code is not updated.
  392. */
  393. function socket_getsockname ($socket, &$addr, &$port = null) {}
  394. /**
  395. * 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
  396. * @link http://www.php.net/manual/en/function.socket-getpeername.php
  397. * @param socket resource <p>
  398. * A valid socket resource created with socket_create
  399. * or socket_accept.
  400. * </p>
  401. * @param address string <p>
  402. * If the given socket is of type AF_INET or
  403. * AF_INET6, socket_getpeername
  404. * will return the peers (remote) IP address in
  405. * appropriate notation (e.g. 127.0.0.1 or
  406. * fe80::1) in the address
  407. * parameter and, if the optional port parameter is
  408. * present, also the associated port.
  409. * </p>
  410. * <p>
  411. * If the given socket is of type AF_UNIX,
  412. * socket_getpeername will return the Unix filesystem
  413. * path (e.g. /var/run/daemon.sock) in the
  414. * address parameter.
  415. * </p>
  416. * @param port int[optional] <p>
  417. * If given, this will hold the port associated to
  418. * address.
  419. * </p>
  420. * @return bool Returns true on success or false on failure. socket_getpeername may also return
  421. * false if the socket type is not any of AF_INET,
  422. * AF_INET6, or AF_UNIX, in which
  423. * case the last socket error code is not updated.
  424. */
  425. function socket_getpeername ($socket, &$address, &$port = null) {}
  426. /**
  427. * Initiates a connection on a socket
  428. * @link http://www.php.net/manual/en/function.socket-connect.php
  429. * @param socket resource <p>
  430. * </p>
  431. * @param address string <p>
  432. * The address parameter is either an IPv4 address
  433. * in dotted-quad notation (e.g. 127.0.0.1) if
  434. * socket is AF_INET, a valid
  435. * IPv6 address (e.g. ::1) if IPv6 support is enabled and
  436. * socket is AF_INET6
  437. * or the pathname of a Unix domain socket, if the socket family is
  438. * AF_UNIX.
  439. * </p>
  440. * @param port int[optional] <p>
  441. * The port parameter is only used and is mandatory
  442. * when connecting to an AF_INET or an
  443. * AF_INET6 socket, and designates
  444. * the port on the remote host to which a connection should be made.
  445. * </p>
  446. * @return bool Returns true on success or false on failure. The error code can be retrieved with
  447. * socket_last_error. This code may be passed to
  448. * socket_strerror to get a textual explanation of the
  449. * error.
  450. * </p>
  451. * <p>
  452. * If the socket is non-blocking then this function returns false with an
  453. * error Operation now in progress.
  454. */
  455. function socket_connect ($socket, $address, $port = null) {}
  456. /**
  457. * Return a string describing a socket error
  458. * @link http://www.php.net/manual/en/function.socket-strerror.php
  459. * @param errno int <p>
  460. * A valid socket error number, likely produced by
  461. * socket_last_error.
  462. * </p>
  463. * @return string the error message associated with the errno
  464. * parameter.
  465. */
  466. function socket_strerror ($errno) {}
  467. /**
  468. * Binds a name to a socket
  469. * @link http://www.php.net/manual/en/function.socket-bind.php
  470. * @param socket resource <p>
  471. * A valid socket resource created with socket_create.
  472. * </p>
  473. * @param address string <p>
  474. * If the socket is of the AF_INET family, the
  475. * address is an IP in dotted-quad notation
  476. * (e.g. 127.0.0.1).
  477. * </p>
  478. * <p>
  479. * If the socket is of the AF_UNIX family, the
  480. * address is the path of a
  481. * Unix-domain socket (e.g. /tmp/my.sock).
  482. * </p>
  483. * @param port int[optional] <p>
  484. * The port parameter is only used when
  485. * binding an AF_INET socket, and designates
  486. * the port on which to listen for connections.
  487. * </p>
  488. * @return bool Returns true on success or false on failure.
  489. * </p>
  490. * <p>
  491. * The error code can be retrieved with socket_last_error.
  492. * This code may be passed to socket_strerror to get a
  493. * textual explanation of the error.
  494. */
  495. function socket_bind ($socket, $address, $port = null) {}
  496. /**
  497. * Receives data from a connected socket
  498. * @link http://www.php.net/manual/en/function.socket-recv.php
  499. * @param socket resource <p>
  500. * The socket must be a socket resource previously
  501. * created by socket_create().
  502. * </p>
  503. * @param buf string <p>
  504. * The data received will be fetched to the variable specified with
  505. * buf. If an error occurs, if the
  506. * connection is reset, or if no data is
  507. * available, buf will be set to &null;.
  508. * </p>
  509. * @param len int <p>
  510. * Up to len bytes will be fetched from remote host.
  511. * </p>
  512. * @param flags int <p>
  513. * The value of flags can be any combination of
  514. * the following flags, joined with the binary OR (|)
  515. * operator.
  516. * </p>
  517. * <table>
  518. * Possible values for flags
  519. * <tr valign="top">
  520. * <td>Flag</td>
  521. * <td>Description</td>
  522. * </tr>
  523. * <tr valign="top">
  524. * <td>MSG_OOB</td>
  525. * <td>
  526. * Process out-of-band data.
  527. * </td>
  528. * </tr>
  529. * <tr valign="top">
  530. * <td>MSG_PEEK</td>
  531. * <td>
  532. * Receive data from the beginning of the receive queue without
  533. * removing it from the queue.
  534. * </td>
  535. * </tr>
  536. * <tr valign="top">
  537. * <td>MSG_WAITALL</td>
  538. * <td>
  539. * Block until at least len are received.
  540. * However, if a signal is caught or the remote host disconnects, the
  541. * function may return less data.
  542. * </td>
  543. * </tr>
  544. * <tr valign="top">
  545. * <td>MSG_DONTWAIT</td>
  546. * <td>
  547. * With this flag set, the function returns even if it would normally
  548. * have blocked.
  549. * </td>
  550. * </tr>
  551. * </table>
  552. * @return int socket_recv returns the number of bytes received,
  553. * or false if there was an error. The actual error code can be retrieved by
  554. * calling socket_last_error. This error code may be
  555. * passed to socket_strerror to get a textual explanation
  556. * of the error.
  557. */
  558. function socket_recv ($socket, &$buf, $len, $flags) {}
  559. /**
  560. * Sends data to a connected socket
  561. * @link http://www.php.net/manual/en/function.socket-send.php
  562. * @param socket resource <p>
  563. * A valid socket resource created with socket_create
  564. * or socket_accept.
  565. * </p>
  566. * @param buf string <p>
  567. * A buffer containing the data that will be sent to the remote host.
  568. * </p>
  569. * @param len int <p>
  570. * The number of bytes that will be sent to the remote host from
  571. * buf.
  572. * </p>
  573. * @param flags int <p>
  574. * The value of flags can be any combination of
  575. * the following flags, joined with the binary OR (|)
  576. * operator.
  577. * <table>
  578. * Possible values for flags
  579. * <tr valign="top">
  580. * <td>MSG_OOB</td>
  581. * <td>
  582. * Send OOB (out-of-band) data.
  583. * </td>
  584. * </tr>
  585. * <tr valign="top">
  586. * <td>MSG_EOR</td>
  587. * <td>
  588. * Indicate a record mark. The sent data completes the record.
  589. * </td>
  590. * </tr>
  591. * <tr valign="top">
  592. * <td>MSG_EOF</td>
  593. * <td>
  594. * Close the sender side of the socket and include an appropriate
  595. * notification of this at the end of the sent data. The sent data
  596. * completes the transaction.
  597. * </td>
  598. * </tr>
  599. * <tr valign="top">
  600. * <td>MSG_DONTROUTE</td>
  601. * <td>
  602. * Bypass routing, use direct interface.
  603. * </td>
  604. * </tr>
  605. * </table>
  606. * </p>
  607. * @return int socket_send returns the number of bytes sent, or false on error.
  608. */
  609. function socket_send ($socket, $buf, $len, $flags) {}
  610. /**
  611. * Receives data from a socket whether or not it is connection-oriented
  612. * @link http://www.php.net/manual/en/function.socket-recvfrom.php
  613. * @param socket resource <p>
  614. * The socket must be a socket resource previously
  615. * created by socket_create().
  616. * </p>
  617. * @param buf string <p>
  618. * The data received will be fetched to the variable specified with
  619. * buf.
  620. * </p>
  621. * @param len int <p>
  622. * Up to len bytes will be fetched from remote host.
  623. * </p>
  624. * @param flags int <p>
  625. * The value of flags can be any combination of
  626. * the following flags, joined with the binary OR (|)
  627. * operator.
  628. * </p>
  629. * <table>
  630. * Possible values for flags
  631. * <tr valign="top">
  632. * <td>Flag</td>
  633. * <td>Description</td>
  634. * </tr>
  635. * <tr valign="top">
  636. * <td>MSG_OOB</td>
  637. * <td>
  638. * Process out-of-band data.
  639. * </td>
  640. * </tr>
  641. * <tr valign="top">
  642. * <td>MSG_PEEK</td>
  643. * <td>
  644. * Receive data from the beginning of the receive queue without
  645. * removing it from the queue.
  646. * </td>
  647. * </tr>
  648. * <tr valign="top">
  649. * <td>MSG_WAITALL</td>
  650. * <td>
  651. * Block until at least len are received.
  652. * However, if a signal is caught or the remote host disconnects, the
  653. * function may return less data.
  654. * </td>
  655. * </tr>
  656. * <tr valign="top">
  657. * <td>MSG_DONTWAIT</td>
  658. * <td>
  659. * With this flag set, the function returns even if it would normally
  660. * have blocked.
  661. * </td>
  662. * </tr>
  663. * </table>
  664. * @param name string <p>
  665. * If the socket is of the type AF_UNIX type,
  666. * name is the path to the file. Else, for
  667. * unconnected sockets, name is the IP address of,
  668. * the remote host, or &null; if the socket is connection-oriented.
  669. * </p>
  670. * @param port int[optional] <p>
  671. * This argument only applies to AF_INET and
  672. * AF_INET6 sockets, and specifies the remote port
  673. * from which the data is received. If the socket is connection-oriented,
  674. * port will be &null;.
  675. * </p>
  676. * @return int socket_recvfrom returns the number of bytes received,
  677. * or false if there was an error. The actual error code can be retrieved by
  678. * calling socket_last_error. This error code may be
  679. * passed to socket_strerror to get a textual explanation
  680. * of the error.
  681. */
  682. function socket_recvfrom ($socket, &$buf, $len, $flags, &$name, &$port = null) {}
  683. /**
  684. * Sends a message to a socket, whether it is connected or not
  685. * @link http://www.php.net/manual/en/function.socket-sendto.php
  686. * @param socket resource <p>
  687. * A valid socket resource created using socket_create.
  688. * </p>
  689. * @param buf string <p>
  690. * The sent data will be taken from buffer buf.
  691. * </p>
  692. * @param len int <p>
  693. * len bytes from buf will be
  694. * sent.
  695. * </p>
  696. * @param flags int <p>
  697. * The value of flags can be any combination of
  698. * the following flags, joined with the binary OR (|)
  699. * operator.
  700. * <table>
  701. * Possible values for flags
  702. * <tr valign="top">
  703. * <td>MSG_OOB</td>
  704. * <td>
  705. * Send OOB (out-of-band) data.
  706. * </td>
  707. * </tr>
  708. * <tr valign="top">
  709. * <td>MSG_EOR</td>
  710. * <td>
  711. * Indicate a record mark. The sent data completes the record.
  712. * </td>
  713. * </tr>
  714. * <tr valign="top">
  715. * <td>MSG_EOF</td>
  716. * <td>
  717. * Close the sender side of the socket and include an appropriate
  718. * notification of this at the end of the sent data. The sent data
  719. * completes the transaction.
  720. * </td>
  721. * </tr>
  722. * <tr valign="top">
  723. * <td>MSG_DONTROUTE</td>
  724. * <td>
  725. * Bypass routing, use direct interface.
  726. * </td>
  727. * </tr>
  728. * </table>
  729. * </p>
  730. * @param addr string <p>
  731. * IP address of the remote host.
  732. * </p>
  733. * @param port int[optional] <p>
  734. * port is the remote port number at which the data
  735. * will be sent.
  736. * </p>
  737. * @return int socket_sendto returns the number of bytes sent to the
  738. * remote host, or false if an error occurred.
  739. */
  740. function socket_sendto ($socket, $buf, $len, $flags, $addr, $port = null) {}
  741. /**
  742. * Gets socket options for the socket
  743. * @link http://www.php.net/manual/en/function.socket-get-option.php
  744. * @param socket resource <p>
  745. * A valid socket resource created with socket_create
  746. * or socket_accept.
  747. * </p>
  748. * @param level int <p>
  749. * The level parameter specifies the protocol
  750. * level at which the option resides. For example, to retrieve options at
  751. * the socket level, a level parameter of
  752. * SOL_SOCKET would be used. Other levels, such as
  753. * TCP, can be used by
  754. * specifying the protocol number of that level. Protocol numbers can be
  755. * found by using the getprotobyname function.
  756. * </p>
  757. * @param optname int <table>
  758. * Available Socket Options
  759. * <tr valign="top">
  760. * <td>Option</td>
  761. * <td>Description</td>
  762. * <td>Type</td>
  763. * </tr>
  764. * <tr valign="top">
  765. * <td>SO_DEBUG</td>
  766. * <td>
  767. * Reports whether debugging information is being recorded.
  768. * </td>
  769. * <td>
  770. * int
  771. * </td>
  772. * </tr>
  773. * <tr valign="top">
  774. * <td>SO_BROADCAST</td>
  775. * <td>
  776. * Reports whether transmission of broadcast messages is supported.
  777. * </td>
  778. * <td>
  779. * int
  780. * </td>
  781. * </tr>
  782. * <tr valign="top">
  783. * <td>SO_REUSEADDR</td>
  784. * <td>
  785. * Reports whether local addresses can be reused.
  786. * </td>
  787. * <td>
  788. * int
  789. * </td>
  790. * </tr>
  791. * <tr valign="top">
  792. * <td>SO_KEEPALIVE</td>
  793. * <td>
  794. * Reports whether connections are kept active with periodic transmission
  795. * of messages. If the connected socket fails to respond to these messages,
  796. * the connection is broken and processes writing to that socket are notified
  797. * with a SIGPIPE signal.
  798. * </td>
  799. * <td>
  800. * int
  801. * </td>
  802. * </tr>
  803. * <tr valign="top">
  804. * <td>SO_LINGER</td>
  805. * <td>
  806. * <p>
  807. * Reports whether the socket lingers on
  808. * socket_close if data is present. By default,
  809. * when the socket is closed, it attempts to send all unsent data.
  810. * In the case of a connection-oriented socket,
  811. * socket_close will wait for its peer to
  812. * acknowledge the data.
  813. * </p>
  814. * <p>
  815. * If l_onoff is non-zero and
  816. * l_linger is zero, all the
  817. * unsent data will be discarded and RST (reset) is sent to the
  818. * peer in the case of a connection-oriented socket.
  819. * </p>
  820. * <p>
  821. * On the other hand, if l_onoff is
  822. * non-zero and l_linger is non-zero,
  823. * socket_close will block until all the data
  824. * is sent or the time specified in l_linger
  825. * elapses. If the socket is non-blocking,
  826. * socket_close will fail and return an error.
  827. * </p>
  828. * </td>
  829. * <td>
  830. * array. The array will contain two keys:
  831. * l_onoff and
  832. * l_linger.
  833. * </td>
  834. * </tr>
  835. * <tr valign="top">
  836. * <td>SO_OOBINLINE</td>
  837. * <td>
  838. * Reports whether the socket leaves out-of-band data inline.
  839. * </td>
  840. * <td>
  841. * int
  842. * </td>
  843. * </tr>
  844. * <tr valign="top">
  845. * <td>SO_SNDBUF</td>
  846. * <td>
  847. * Reports the size of the send buffer.
  848. * </td>
  849. * <td>
  850. * int
  851. * </td>
  852. * </tr>
  853. * <tr valign="top">
  854. * <td>SO_RCVBUF</td>
  855. * <td>
  856. * Reports the size of the receive buffer.
  857. * </td>
  858. * <td>
  859. * int
  860. * </td>
  861. * </tr>
  862. * <tr valign="top">
  863. * <td>SO_ERROR</td>
  864. * <td>
  865. * Reports information about error status and clears it.
  866. * </td>
  867. * <td>
  868. * int (cannot be set by socket_set_option)
  869. * </td>
  870. * </tr>
  871. * <tr valign="top">
  872. * <td>SO_TYPE</td>
  873. * <td>
  874. * Reports the socket type (e.g.
  875. * SOCK_STREAM).
  876. * </td>
  877. * <td>
  878. * int (cannot be set by socket_set_option)
  879. * </td>
  880. * </tr>
  881. * <tr valign="top">
  882. * <td>SO_DONTROUTE</td>
  883. * <td>
  884. * Reports whether outgoing messages bypass the standard routing facilities.
  885. * </td>
  886. * <td>
  887. * int
  888. * </td>
  889. * </tr>
  890. * <tr valign="top">
  891. * <td>SO_RCVLOWAT</td>
  892. * <td>
  893. * Reports the minimum number of bytes to process for socket
  894. * input operations.
  895. * </td>
  896. * <td>
  897. * int
  898. * </td>
  899. * </tr>
  900. * <tr valign="top">
  901. * <td>SO_RCVTIMEO</td>
  902. * <td>
  903. * Reports the timeout value for input operations.
  904. * </td>
  905. * <td>
  906. * array. The array will contain two keys:
  907. * sec which is the seconds part on the timeout
  908. * value and usec which is the microsecond part
  909. * of the timeout value.
  910. * </td>
  911. * </tr>
  912. * <tr valign="top">
  913. * <td>SO_SNDTIMEO</td>
  914. * <td>
  915. * Reports the timeout value specifying the amount of time that an output
  916. * function blocks because flow control prevents data from being sent.
  917. * </td>
  918. * <td>
  919. * array. The array will contain two keys:
  920. * sec which is the seconds part on the timeout
  921. * value and usec which is the microsecond part
  922. * of the timeout value.
  923. * </td>
  924. * </tr>
  925. * <tr valign="top">
  926. * <td>SO_SNDLOWAT</td>
  927. * <td>
  928. * Reports the minimum number of bytes to process for socket output operations.
  929. * </td>
  930. * <td>
  931. * int
  932. * </td>
  933. * </tr>
  934. * <tr valign="top">
  935. * <td>TCP_NODELAY</td>
  936. * <td>
  937. * Reports whether the Nagle TCP algorithm is disabled.
  938. * </td>
  939. * <td>
  940. * int
  941. * </td>
  942. * </tr>
  943. * <tr valign="top">
  944. * <td>MCAST_JOIN_GROUP</td>
  945. * <td>
  946. * Joins a multicast group. (added in PHP 5.4)
  947. * </td>
  948. * <td>
  949. * array with keys "group", specifying
  950. * a string with an IPv4 or IPv6 multicast address and
  951. * "interface", specifying either an interface
  952. * number (type int) or a string with
  953. * the interface name, like "eth0".
  954. * 0 can be specified to indicate the interface
  955. * should be selected using routing rules. (can only be used in
  956. * socket_set_option)
  957. * </td>
  958. * </tr>
  959. * <tr valign="top">
  960. * <td>MCAST_LEAVE_GROUP</td>
  961. * <td>
  962. * Leaves a multicast group. (added in PHP 5.4)
  963. * </td>
  964. * <td>
  965. * array. See MCAST_JOIN_GROUP for
  966. * more information. (can only be used in
  967. * socket_set_option)
  968. * </td>
  969. * </tr>
  970. * <tr valign="top">
  971. * <td>MCAST_BLOCK_SOURCE</td>
  972. * <td>
  973. * Blocks packets arriving from a specific source to a specific
  974. * multicast group, which must have been previously joined.
  975. * (added in PHP 5.4)
  976. * </td>
  977. * <td>
  978. * array with the same keys as
  979. * MCAST_JOIN_GROUP, plus one extra key,
  980. * source, which maps to a string
  981. * specifying an IPv4 or IPv6 address of the source to be blocked.
  982. * (can only be used in socket_set_option)
  983. * </td>
  984. * </tr>
  985. * <tr valign="top">
  986. * <td>MCAST_UNBLOCK_SOURCE</td>
  987. * <td>
  988. * Unblocks (start receiving again) packets arriving from a specific
  989. * source address to a specific multicast group, which must have been
  990. * previously joined. (added in PHP 5.4)
  991. * </td>
  992. * <td>
  993. * array with the same format as
  994. * MCAST_BLOCK_SOURCE.
  995. * (can only be used in socket_set_option)
  996. * </td>
  997. * </tr>
  998. * <tr valign="top">
  999. * <td>MCAST_JOIN_SOURCE_GROUP</td>
  1000. * <td>
  1001. * Receive packets destined to a specific multicast group whose source
  1002. * address matches a specific value. (added in PHP 5.4)
  1003. * </td>
  1004. * <td>
  1005. * array with the same format as
  1006. * MCAST_BLOCK_SOURCE.
  1007. * (can only be used in socket_set_option)
  1008. * </td>
  1009. * </tr>
  1010. * <tr valign="top">
  1011. * <td>MCAST_LEAVE_SOURCE_GROUP</td>
  1012. * <td>
  1013. * Stop receiving packets destined to a specific multicast group whose
  1014. * soure address matches a specific value. (added in PHP 5.4)
  1015. * </td>
  1016. * <td>
  1017. * array with the same format as
  1018. * MCAST_BLOCK_SOURCE.
  1019. * (can only be used in socket_set_option)
  1020. * </td>
  1021. * </tr>
  1022. * <tr valign="top">
  1023. * <td>IP_MULTICAST_IF</td>
  1024. * <td>
  1025. * The outgoing interface for IPv4 multicast packets.
  1026. * (added in PHP 5.4)
  1027. * </td>
  1028. * <td>
  1029. * Either int specifying the interface number or a
  1030. * string with an interface name, like
  1031. * eth0. The value 0 can be used to
  1032. * indicate the routing table is to used in the interface selection.
  1033. * The function socket_get_option returns an
  1034. * interface index.
  1035. * Note that, unlike the C API, this option does NOT take an IP
  1036. * address. This eliminates the interface difference between
  1037. * IP_MULTICAST_IF and
  1038. * IPV6_MULTICAST_IF.
  1039. * </td>
  1040. * </tr>
  1041. * <tr valign="top">
  1042. * <td>IPV6_MULTICAST_IF</td>
  1043. * <td>
  1044. * The outgoing interface for IPv6 multicast packets.
  1045. * (added in PHP 5.4)
  1046. * </td>
  1047. * <td>
  1048. * The same as IP_MULTICAST_IF.
  1049. * </td>
  1050. * </tr>
  1051. * <tr valign="top">
  1052. * <td>IP_MULTICAST_LOOP</td>
  1053. * <td>
  1054. * The multicast loopback policy for IPv4 packets, which
  1055. * determines whether multicast packets sent by this socket also reach
  1056. * receivers in the same host that have joined the same multicast group
  1057. * on the outgoing interface used by this socket. This is the case by
  1058. * default.
  1059. * (added in PHP 5.4)
  1060. * </td>
  1061. * <td>
  1062. * int (either 0 or
  1063. * 1). For socket_set_option
  1064. * any value will be accepted and will be converted to a boolean
  1065. * following the usual PHP rules.
  1066. * </td>
  1067. * </tr>
  1068. * <tr valign="top">
  1069. * <td>IPV6_MULTICAST_LOOP</td>
  1070. * <td>
  1071. * Analogous to IP_MULTICAST_LOOP, but for IPv6.
  1072. * (added in PHP 5.4)
  1073. * </td>
  1074. * <td>
  1075. * int. See IP_MULTICAST_LOOP.
  1076. * </td>
  1077. * </tr>
  1078. * <tr valign="top">
  1079. * <td>IP_MULTICAST_TTL</td>
  1080. * <td>
  1081. * The time-to-live of outgoing IPv4 multicast packets. This should be
  1082. * a value between 0 (don't leave the interface) and 255. The default
  1083. * value is 1 (only the local network is reached).
  1084. * (added in PHP 5.4)
  1085. * </td>
  1086. * <td>
  1087. * int between 0 and 255.
  1088. * </td>
  1089. * </tr>
  1090. * <tr valign="top">
  1091. * <td>IPV6_MULTICAST_HOPS</td>
  1092. * <td>
  1093. * Analogous to IP_MULTICAST_TTL, but for IPv6
  1094. * packets. The value -1 is also accepted, meaning the route default
  1095. * should be used.
  1096. * (added in PHP 5.4)
  1097. * </td>
  1098. * <td>
  1099. * int between -1 and 255.
  1100. * </td>
  1101. * </tr>
  1102. * </table>
  1103. * @return mixed the value of the given option, or false on errors.
  1104. */
  1105. function socket_get_option ($socket, $level, $optname) {}
  1106. /**
  1107. * Sets socket options for the socket
  1108. * @link http://www.php.net/manual/en/function.socket-set-option.php
  1109. * @param socket resource <p>
  1110. * A valid socket resource created with socket_create
  1111. * or socket_accept.
  1112. * </p>
  1113. * @param level int <p>
  1114. * The level parameter specifies the protocol
  1115. * level at which the option resides. For example, to retrieve options at
  1116. * the socket level, a level parameter of
  1117. * SOL_SOCKET would be used. Other levels, such as
  1118. * TCP, can be used by specifying the protocol number of that level.
  1119. * Protocol numbers can be found by using the
  1120. * getprotobyname function.
  1121. * </p>
  1122. * @param optname int <p>
  1123. * The available socket options are the same as those for the
  1124. * socket_get_option function.
  1125. * </p>
  1126. * @param optval mixed <p>
  1127. * The option value.
  1128. * </p>
  1129. * @return bool Returns true on success or false on failure.
  1130. */
  1131. function socket_set_option ($socket, $level, $optname, $optval) {}
  1132. /**
  1133. * Shuts down a socket for receiving, sending, or both
  1134. * @link http://www.php.net/manual/en/function.socket-shutdown.php
  1135. * @param socket resource <p>
  1136. * A valid socket resource created with socket_create.
  1137. * </p>
  1138. * @param how int[optional] <p>
  1139. * The value of how can be one of the following:
  1140. * <table>
  1141. * possible values for how
  1142. * <tr valign="top">
  1143. * <td>0</td>
  1144. * <td>
  1145. * Shutdown socket reading
  1146. * </td>
  1147. * </tr>
  1148. * <tr valign="top">
  1149. * <td>1</td>
  1150. * <td>
  1151. * Shutdown socket writing
  1152. * </td>
  1153. * </tr>
  1154. * <tr valign="top">
  1155. * <td>2</td>
  1156. * <td>
  1157. * Shutdown socket reading and writing
  1158. * </td>
  1159. * </tr>
  1160. * </table>
  1161. * </p>
  1162. * @return bool Returns true on success or false on failure.
  1163. */
  1164. function socket_shutdown ($socket, $how = null) {}
  1165. /**
  1166. * Returns the last error on the socket
  1167. * @link http://www.php.net/manual/en/function.socket-last-error.php
  1168. * @param socket resource[optional] <p>
  1169. * A valid socket resource created with socket_create.
  1170. * </p>
  1171. * @return int This function returns a socket error code.
  1172. */
  1173. function socket_last_error ($socket = null) {}
  1174. /**
  1175. * Clears the error on the socket or the last error code
  1176. * @link http://www.php.net/manual/en/function.socket-clear-error.php
  1177. * @param socket resource[optional] <p>
  1178. * A valid socket resource created with socket_create.
  1179. * </p>
  1180. * @return void
  1181. */
  1182. function socket_clear_error ($socket = null) {}
  1183. /**
  1184. * Import a stream
  1185. * @link http://www.php.net/manual/en/function.socket-import-stream.php
  1186. * @param stream resource <p>
  1187. * The stream resource to import.
  1188. * </p>
  1189. * @return resource false or &null; on failure.
  1190. */
  1191. function socket_import_stream ($stream) {}
  1192. /**
  1193. * Send a message
  1194. * @link http://www.php.net/manual/en/function.socket-sendmsg.php
  1195. * @param socket resource <p>
  1196. * </p>
  1197. * @param message array <p>
  1198. * </p>
  1199. * @param flags int <p>
  1200. * </p>
  1201. * @return int
  1202. */
  1203. function socket_sendmsg ($socket, array $message, $flags) {}
  1204. /**
  1205. * Read a message
  1206. * @link http://www.php.net/manual/en/function.socket-recvmsg.php
  1207. * @param socket resource <p>
  1208. * </p>
  1209. * @param message string <p>
  1210. * </p>
  1211. * @param flags int[optional] <p>
  1212. * </p>
  1213. * @return int
  1214. */
  1215. function socket_recvmsg ($socket, $message, $flags = null) {}
  1216. /**
  1217. * Calculate message buffer size
  1218. * @link http://www.php.net/manual/en/function.socket-cmsg-space.php
  1219. * @param level int <p>
  1220. * </p>
  1221. * @param type int <p>
  1222. * </p>
  1223. * @return int
  1224. */
  1225. function socket_cmsg_space ($level, $type) {}
  1226. /**
  1227. * @param socket
  1228. * @param level
  1229. * @param optname
  1230. */
  1231. function socket_getopt ($socket, $level, $optname) {}
  1232. /**
  1233. * @param socket
  1234. * @param level
  1235. * @param optname
  1236. * @param optval
  1237. */
  1238. function socket_setopt ($socket, $level, $optname, $optval) {}
  1239. define ('AF_UNIX', 1);
  1240. define ('AF_INET', 2);
  1241. define ('SOCK_STREAM', 1);
  1242. define ('SOCK_DGRAM', 2);
  1243. define ('SOCK_RAW', 3);
  1244. define ('SOCK_SEQPACKET', 5);
  1245. define ('SOCK_RDM', 4);
  1246. define ('MSG_OOB', 1);
  1247. define ('MSG_WAITALL', 8);
  1248. define ('MSG_CTRUNC', 512);
  1249. define ('MSG_TRUNC', 256);
  1250. define ('MSG_PEEK', 2);
  1251. define ('MSG_DONTROUTE', 4);
  1252. define ('SO_DEBUG', 1);
  1253. define ('SO_REUSEADDR', 4);
  1254. define ('SO_KEEPALIVE', 8);
  1255. define ('SO_DONTROUTE', 16);
  1256. define ('SO_LINGER', 128);
  1257. define ('SO_BROADCAST', 32);
  1258. define ('SO_OOBINLINE', 256);
  1259. define ('SO_SNDBUF', 4097);
  1260. define ('SO_RCVBUF', 4098);
  1261. define ('SO_SNDLOWAT', 4099);
  1262. define ('SO_RCVLOWAT', 4100);
  1263. define ('SO_SNDTIMEO', 4101);
  1264. define ('SO_RCVTIMEO', 4102);
  1265. define ('SO_TYPE', 4104);
  1266. define ('SO_ERROR', 4103);
  1267. define ('SOL_SOCKET', 65535);
  1268. define ('SOMAXCONN', 2147483647);
  1269. define ('TCP_NODELAY', 1);
  1270. define ('PHP_NORMAL_READ', 1);
  1271. define ('PHP_BINARY_READ', 2);
  1272. define ('MCAST_JOIN_GROUP', 41);
  1273. define ('MCAST_LEAVE_GROUP', 42);
  1274. define ('MCAST_BLOCK_SOURCE', 43);
  1275. define ('MCAST_UNBLOCK_SOURCE', 44);
  1276. define ('MCAST_JOIN_SOURCE_GROUP', 45);
  1277. define ('MCAST_LEAVE_SOURCE_GROUP', 46);
  1278. define ('IP_MULTICAST_IF', 9);
  1279. define ('IP_MULTICAST_TTL', 10);
  1280. define ('IP_MULTICAST_LOOP', 11);
  1281. define ('SOCKET_EINTR', 10004);
  1282. define ('SOCKET_EBADF', 10009);
  1283. define ('SOCKET_EACCES', 10013);
  1284. define ('SOCKET_EFAULT', 10014);
  1285. define ('SOCKET_EINVAL', 10022);
  1286. define ('SOCKET_EMFILE', 10024);
  1287. define ('SOCKET_EWOULDBLOCK', 10035);
  1288. define ('SOCKET_EINPROGRESS', 10036);
  1289. define ('SOCKET_EALREADY', 10037);
  1290. define ('SOCKET_ENOTSOCK', 10038);
  1291. define ('SOCKET_EDESTADDRREQ', 10039);
  1292. define ('SOCKET_EMSGSIZE', 10040);
  1293. define ('SOCKET_EPROTOTYPE', 10041);
  1294. define ('SOCKET_ENOPROTOOPT', 10042);
  1295. define ('SOCKET_EPROTONOSUPPORT', 10043);
  1296. define ('SOCKET_ESOCKTNOSUPPORT', 10044);
  1297. define ('SOCKET_EOPNOTSUPP', 10045);
  1298. define ('SOCKET_EPFNOSUPPORT', 10046);
  1299. define ('SOCKET_EAFNOSUPPORT', 10047);
  1300. define ('SOCKET_EADDRINUSE', 10048);
  1301. define ('SOCKET_EADDRNOTAVAIL', 10049);
  1302. define ('SOCKET_ENETDOWN', 10050);
  1303. define ('SOCKET_ENETUNREACH', 10051);
  1304. define ('SOCKET_ENETRESET', 10052);
  1305. define ('SOCKET_ECONNABORTED', 10053);
  1306. define ('SOCKET_ECONNRESET', 10054);
  1307. define ('SOCKET_ENOBUFS', 10055);
  1308. define ('SOCKET_EISCONN', 10056);
  1309. define ('SOCKET_ENOTCONN', 10057);
  1310. define ('SOCKET_ESHUTDOWN', 10058);
  1311. define ('SOCKET_ETOOMANYREFS', 10059);
  1312. define ('SOCKET_ETIMEDOUT', 10060);
  1313. define ('SOCKET_ECONNREFUSED', 10061);
  1314. define ('SOCKET_ELOOP', 10062);
  1315. define ('SOCKET_ENAMETOOLONG', 10063);
  1316. define ('SOCKET_EHOSTDOWN', 10064);
  1317. define ('SOCKET_EHOSTUNREACH', 10065);
  1318. define ('SOCKET_ENOTEMPTY', 10066);
  1319. define ('SOCKET_EPROCLIM', 10067);
  1320. define ('SOCKET_EUSERS', 10068);
  1321. define ('SOCKET_EDQUOT', 10069);
  1322. define ('SOCKET_ESTALE', 10070);
  1323. define ('SOCKET_EREMOTE', 10071);
  1324. define ('SOCKET_EDISCON', 10101);
  1325. define ('SOCKET_SYSNOTREADY', 10091);
  1326. define ('SOCKET_VERNOTSUPPORTED', 10092);
  1327. define ('SOCKET_NOTINITIALISED', 10093);
  1328. define ('SOCKET_HOST_NOT_FOUND', 11001);
  1329. define ('SOCKET_TRY_AGAIN', 11002);
  1330. define ('SOCKET_NO_RECOVERY', 11003);
  1331. define ('SOCKET_NO_DATA', 11004);
  1332. define ('SOCKET_NO_ADDRESS', 11004);
  1333. define ('IPPROTO_IP', 0);
  1334. define ('SOL_TCP', 6);
  1335. define ('SOL_UDP', 17);
  1336. // End of sockets v.