Debian Codegraph @

codelitephp/resources/cc/sockets.php

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