PageRenderTime 26ms CodeModel.GetById 2ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 0ms

/hphp/system/idl/socket.idl.json

http://github.com/facebook/hiphop-php
JSON | 747 lines | 747 code | 0 blank | 0 comment | 0 complexity | 2e4ade3772a9a849ee06ece5ac2c20d7 MD5 | raw file
  1{
  2    "preamble": "",
  3    "consts": [
  4    ],
  5    "funcs": [
  6        {
  7            "name": "socket_create",
  8            "desc": "Creates and returns a socket resource, also referred to as an endpoint of communication. A typical network connection is made up of 2 sockets, one performing the role of the client, and another performing the role of the server.",
  9            "flags": [
 10            ],
 11            "return": {
 12                "type": "Variant",
 13                "desc": "socket_create() returns a socket resource on success, or FALSE on error. The actual error code can be retrieved by calling socket_last_error(). This error code may be passed to socket_strerror() to get a textual explanation of the error."
 14            },
 15            "args": [
 16                {
 17                    "name": "domain",
 18                    "type": "Int32",
 19                    "desc": "The domain parameter specifies the protocol family to be used by the socket. Available address\/protocol families Domain Description AF_INET IPv4 Internet based protocols. TCP and UDP are common protocols of this protocol family. AF_INET6 IPv6 Internet based protocols. TCP and UDP are common protocols of this protocol family. AF_UNIX Local communication protocol family. High efficiency and low overhead make it a great form of IPC (Interprocess Communication)."
 20                },
 21                {
 22                    "name": "type",
 23                    "type": "Int32",
 24                    "desc": "The type parameter selects the type of communication to be used by the socket. Available socket types Type Description SOCK_STREAM Provides sequenced, reliable, full-duplex, connection-based byte streams. An out-of-band data transmission mechanism may be supported. The TCP protocol is based on this socket type. SOCK_DGRAM Supports datagrams (connectionless, unreliable messages of a fixed maximum length). The UDP protocol is based on this socket type. SOCK_SEQPACKET Provides a sequenced, reliable, two-way connection-based data transmission path for datagrams of fixed maximum length; a consumer is required to read an entire packet with each read call. SOCK_RAW Provides raw network protocol access. This special type of socket can be used to manually construct any type of protocol. A common use for this socket type is to perform ICMP requests (like ping). SOCK_RDM Provides a reliable datagram layer that does not guarantee ordering. This is most likely not implemented on your operating system."
 25                },
 26                {
 27                    "name": "protocol",
 28                    "type": "Int32",
 29                    "desc": "The protocol parameter sets the specific protocol within the specified domain to be used when communicating on the returned socket. The proper value can be retrieved by name by using getprotobyname(). If the desired protocol is TCP, or UDP the corresponding constants SOL_TCP, and SOL_UDP can also be used. Common protocols Name Description icmp The Internet Control Message Protocol is used primarily by gateways and hosts to report errors in datagram communication. The \"ping\" command (present in most modern operating systems) is an example application of ICMP. udp The User Datagram Protocol is a connectionless, unreliable, protocol with fixed record lengths. Due to these aspects, UDP requires a minimum amount of protocol overhead. tcp The Transmission Control Protocol is a reliable, connection based, stream oriented, full duplex protocol. TCP guarantees that all data packets will be received in the order in which they were sent. If any packet is somehow lost during communication, TCP will automatically retransmit the packet until the destination host acknowledges that packet. For reliability and performance reasons, the TCP implementation itself decides the appropriate octet boundaries of the underlying datagram communication layer. Therefore, TCP applications must allow for the possibility of partial record transmission."
 30                }
 31            ]
 32        },
 33        {
 34            "name": "socket_create_listen",
 35            "desc": "socket_create_listen() creates a new socket resource of type AF_INET listening on all local interfaces on the given port waiting for new connections.\n\nThis function is meant to ease the task of creating a new socket which only listens to accept new connections.",
 36            "flags": [
 37            ],
 38            "return": {
 39                "type": "Variant",
 40                "desc": "socket_create_listen() returns a new socket resource on success or FALSE on error. The error code can be retrieved with socket_last_error(). This code may be passed to socket_strerror() to get a textual explanation of the error."
 41            },
 42            "args": [
 43                {
 44                    "name": "port",
 45                    "type": "Int32",
 46                    "desc": "The port on which to listen on all interfaces."
 47                },
 48                {
 49                    "name": "backlog",
 50                    "type": "Int32",
 51                    "value": "128",
 52                    "desc": "The backlog parameter defines the maximum length the queue of pending connections may grow to. SOMAXCONN may be passed as backlog parameter, see socket_listen() for more information."
 53                }
 54            ]
 55        },
 56        {
 57            "name": "socket_create_pair",
 58            "desc": "socket_create_pair() creates two connected and indistinguishable sockets, and stores them in fd. This function is commonly used in IPC (InterProcess Communication).",
 59            "flags": [
 60            ],
 61            "return": {
 62                "type": "Boolean",
 63                "desc": "Returns TRUE on success or FALSE on failure."
 64            },
 65            "args": [
 66                {
 67                    "name": "domain",
 68                    "type": "Int32",
 69                    "desc": "The domain parameter specifies the protocol family to be used by the socket. See socket_create() for the full list."
 70                },
 71                {
 72                    "name": "type",
 73                    "type": "Int32",
 74                    "desc": "The type parameter selects the type of communication to be used by the socket. See socket_create() for the full list."
 75                },
 76                {
 77                    "name": "protocol",
 78                    "type": "Int32",
 79                    "desc": "The protocol parameter sets the specific protocol within the specified domain to be used when communicating on the returned socket. The proper value can be retrieved by name by using getprotobyname(). If the desired protocol is TCP, or UDP the corresponding constants SOL_TCP, and SOL_UDP can also be used.\n\nSee socket_create() for the full list of supported protocols."
 80                },
 81                {
 82                    "name": "fd",
 83                    "type": "Variant",
 84                    "desc": "Reference to an array in which the two socket resources will be inserted.",
 85                    "ref": true
 86                }
 87            ]
 88        },
 89        {
 90            "name": "socket_get_option",
 91            "desc": "The socket_get_option() function retrieves the value for the option specified by the optname parameter for the specified socket.",
 92            "flags": [
 93            ],
 94            "return": {
 95                "type": "Variant",
 96                "desc": "Returns the value of the given option, or FALSE on errors."
 97            },
 98            "args": [
 99                {
100                    "name": "socket",
101                    "type": "Resource"
102                },
103                {
104                    "name": "level",
105                    "type": "Int32"
106                },
107                {
108                    "name": "optname",
109                    "type": "Int32"
110                }
111            ]
112        },
113        {
114            "name": "socket_getpeername",
115            "desc": "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.",
116            "flags": [
117            ],
118            "return": {
119                "type": "Boolean",
120                "desc": "Returns TRUE on success or FALSE on failure. socket_getpeername() may also return FALSE if the socket type is not any of AF_INET, AF_INET6, or AF_UNIX, in which case the last socket error code is not updated."
121            },
122            "args": [
123                {
124                    "name": "socket",
125                    "type": "Resource",
126                    "desc": "A valid socket resource created with socket_create() or socket_accept()."
127                },
128                {
129                    "name": "address",
130                    "type": "Variant",
131                    "desc": "If the given socket is of type AF_INET or AF_INET6, socket_getpeername() will return the peers (remote) IP address in appropriate notation (e.g. 127.0.0.1 or fe80::1) in the address parameter and, if the optional port parameter is present, also the associated port.\n\nIf the given socket is of type AF_UNIX, socket_getpeername() will return the Unix filesystem path (e.g. \/var\/run\/daemon.sock) in the address parameter.",
132                    "ref": true
133                },
134                {
135                    "name": "port",
136                    "type": "Variant",
137                    "value": "null",
138                    "desc": "If given, this will hold the port associated to address.",
139                    "ref": true
140                }
141            ]
142        },
143        {
144            "name": "socket_getsockname",
145            "flags": [
146            ],
147            "return": {
148                "type": "Boolean",
149                "desc": "Returns TRUE on success or FALSE on failure. socket_getsockname() may also return FALSE if the socket type is not any of AF_INET, AF_INET6, or AF_UNIX, in which case the last socket error code is not updated."
150            },
151            "args": [
152                {
153                    "name": "socket",
154                    "type": "Resource",
155                    "desc": "A valid socket resource created with socket_create() or socket_accept()."
156                },
157                {
158                    "name": "address",
159                    "type": "Variant",
160                    "desc": "If the given socket is of type AF_INET or AF_INET6, socket_getsockname() will return the local IP address in appropriate notation (e.g. 127.0.0.1 or fe80::1) in the address parameter and, if the optional port parameter is present, also the associated port.\n\nIf the given socket is of type AF_UNIX, socket_getsockname() will return the Unix filesystem path (e.g. \/var\/run\/daemon.sock) in the address parameter.",
161                    "ref": true
162                },
163                {
164                    "name": "port",
165                    "type": "Variant",
166                    "value": "null",
167                    "desc": "If provided, this will hold the associated port.",
168                    "ref": true
169                }
170            ]
171        },
172        {
173            "name": "socket_set_block",
174            "desc": "The socket_set_block() function removes the O_NONBLOCK flag on the socket specified by the socket parameter.\n\nWhen an operation (e.g. receive, send, connect, accept, ...) is performed on a blocking socket, the script will pause its execution until it receives a signal or it can perform the operation.",
175            "flags": [
176            ],
177            "return": {
178                "type": "Boolean",
179                "desc": "Returns TRUE on success or FALSE on failure."
180            },
181            "args": [
182                {
183                    "name": "socket",
184                    "type": "Resource",
185                    "desc": "A valid socket resource created with socket_create() or socket_accept()."
186                }
187            ]
188        },
189        {
190            "name": "socket_set_nonblock",
191            "desc": "The socket_set_nonblock() function sets the O_NONBLOCK flag on the socket specified by the socket parameter.\n\nWhen an operation (e.g. receive, send, connect, accept, ...) is performed on a non-blocking socket, the script not pause its execution until it receives a signal or it can perform the operation. Rather, if the operation would result in a block, the called function will fail.",
192            "flags": [
193            ],
194            "return": {
195                "type": "Boolean",
196                "desc": "Returns TRUE on success or FALSE on failure."
197            },
198            "args": [
199                {
200                    "name": "socket",
201                    "type": "Resource",
202                    "desc": "A valid socket resource created with socket_create() or socket_accept()."
203                }
204            ]
205        },
206        {
207            "name": "socket_set_option",
208            "desc": "The socket_set_option() function sets the option specified by the optname parameter, at the specified protocol level, to the value pointed to by the optval parameter for the socket.",
209            "flags": [
210            ],
211            "return": {
212                "type": "Boolean",
213                "desc": "Returns TRUE on success or FALSE on failure."
214            },
215            "args": [
216                {
217                    "name": "socket",
218                    "type": "Resource",
219                    "desc": "A valid socket resource created with socket_create() or socket_accept()."
220                },
221                {
222                    "name": "level",
223                    "type": "Int32",
224                    "desc": "The level parameter specifies the protocol level at which the option resides. For example, to retrieve options at the socket level, a level parameter of SOL_SOCKET would be used. Other levels, such as TCP, can be used by specifying the protocol number of that level. Protocol numbers can be found by using the getprotobyname() function."
225                },
226                {
227                    "name": "optname",
228                    "type": "Int32",
229                    "desc": "The available socket options are the same as those for the socket_get_option() function."
230                },
231                {
232                    "name": "optval",
233                    "type": "Variant",
234                    "desc": "The option value."
235                }
236            ]
237        },
238        {
239            "name": "socket_connect",
240            "desc": "Initiate a connection to address using the socket resource socket, which must be a valid socket resource created with socket_create().",
241            "flags": [
242            ],
243            "return": {
244                "type": "Boolean",
245                "desc": "Returns TRUE on success or FALSE on failure. The error code can be retrieved with socket_last_error(). This code may be passed to socket_strerror() to get a textual explanation of the error.\n\nIf the socket is non-blocking then this function returns FALSE with an error Operation now in progress."
246            },
247            "args": [
248                {
249                    "name": "socket",
250                    "type": "Resource"
251                },
252                {
253                    "name": "address",
254                    "type": "String",
255                    "desc": "The address parameter is either an IPv4 address in dotted-quad notation (e.g. 127.0.0.1) if socket is AF_INET, a valid IPv6 address (e.g. ::1) if IPv6 support is enabled and socket is AF_INET6 or the pathname of a Unix domain socket, if the socket family is AF_UNIX."
256                },
257                {
258                    "name": "port",
259                    "type": "Int32",
260                    "value": "0",
261                    "desc": "The port parameter is only used and is mandatory when connecting to an AF_INET or an AF_INET6 socket, and designates the port on the remote host to which a connection should be made."
262                }
263            ]
264        },
265        {
266            "name": "socket_bind",
267            "desc": "Binds the name given in address to the socket described by socket. This has to be done before a connection is be established using socket_connect() or socket_listen().",
268            "flags": [
269            ],
270            "return": {
271                "type": "Boolean",
272                "desc": "Returns TRUE on success or FALSE on failure.\n\nThe error code can be retrieved with socket_last_error(). This code may be passed to socket_strerror() to get a textual explanation of the error."
273            },
274            "args": [
275                {
276                    "name": "socket",
277                    "type": "Resource",
278                    "desc": "A valid socket resource created with socket_create()."
279                },
280                {
281                    "name": "address",
282                    "type": "String",
283                    "desc": "If the socket is of the AF_INET family, the address is an IP in dotted-quad notation (e.g. 127.0.0.1).\n\nIf the socket is of the AF_UNIX family, the address is the path of a Unix-domain socket (e.g. \/tmp\/my.sock)."
284                },
285                {
286                    "name": "port",
287                    "type": "Int32",
288                    "value": "0",
289                    "desc": "The port parameter is only used when connecting to an AF_INET socket, and designates the port on the remote host to which a connection should be made."
290                }
291            ]
292        },
293        {
294            "name": "socket_listen",
295            "desc": "After the socket socket has been created using socket_create() and bound to a name with socket_bind(), it may be told to listen for incoming connections on socket.\n\nsocket_listen() is applicable only to sockets of type SOCK_STREAM or SOCK_SEQPACKET.",
296            "flags": [
297            ],
298            "return": {
299                "type": "Boolean",
300                "desc": "Returns TRUE on success or FALSE on failure. The error code can be retrieved with socket_last_error(). This code may be passed to socket_strerror() to get a textual explanation of the error."
301            },
302            "args": [
303                {
304                    "name": "socket",
305                    "type": "Resource",
306                    "desc": "A valid socket resource created with socket_create()."
307                },
308                {
309                    "name": "backlog",
310                    "type": "Int32",
311                    "value": "0",
312                    "desc": "A maximum of backlog incoming connections will be queued for processing. If a connection request arrives with the queue full the client may receive an error with an indication of ECONNREFUSED, or, if the underlying protocol supports retransmission, the request may be ignored so that retries may succeed.\n\nThe maximum number passed to the backlog parameter highly depends on the underlying platform. On Linux, it is silently truncated to SOMAXCONN. On win32, if passed SOMAXCONN, the underlying service provider responsible for the socket will set the backlog to a maximum reasonable value. There is no standard provision to find out the actual backlog value on this platform."
313                }
314            ]
315        },
316        {
317            "name": "socket_select",
318            "desc": "socket_select() accepts arrays of sockets and waits for them to change status. Those coming with BSD sockets background will recognize that those socket resource arrays are in fact the so-called file descriptor sets. Three independent arrays of socket resources are watched.\nWarning\n\nOn exit, the arrays are modified to indicate which socket resource actually changed status.\n\nYou do not need to pass every array to socket_select(). You can leave it out and use an empty array or NULL instead. Also do not forget that those arrays are passed by reference and will be modified after socket_select() returns.\n\nDue a limitation in the current Zend Engine it is not possible to pass a constant modifier like NULL directly as a parameter to a function which expects this parameter to be passed by reference. Instead use a temporary variable or an expression with the leftmost member being a temporary variable: Example #1 Using NULL with socket_select()",
319            "flags": [
320            ],
321            "return": {
322                "type": "Variant",
323                "desc": "On success socket_select() returns the number of socket resources contained in the modified arrays, which may be zero if the timeout expires before anything interesting happens. On error FALSE is returned. The error code can be retrieved with socket_last_error().\n\nBe sure to use the === operator when checking for an error. Since the socket_select() may return 0 the comparison with == would evaluate to TRUE: Example #2 Understanding socket_select()'s result"
324            },
325            "args": [
326                {
327                    "name": "read",
328                    "type": "Variant",
329                    "desc": "The sockets listed in the read array will be watched to see if characters become available for reading (more precisely, to see if a read will not block - in particular, a socket resource is also ready on end-of-file, in which case a socket_read() will return a zero length string).",
330                    "ref": true
331                },
332                {
333                    "name": "write",
334                    "type": "Variant",
335                    "desc": "The sockets listed in the write array will be watched to see if a write will not block.",
336                    "ref": true
337                },
338                {
339                    "name": "except",
340                    "type": "Variant",
341                    "desc": "The sockets listed in the except array will be watched for exceptions.",
342                    "ref": true
343                },
344                {
345                    "name": "vtv_sec",
346                    "type": "Variant",
347                    "desc": "The tv_sec and tv_usec together form the timeout parameter. The timeout is an upper bound on the amount of time elapsed before socket_select() return. tv_sec may be zero , causing socket_select() to return immediately. This is useful for polling. If tv_sec is NULL (no timeout), socket_select() can block indefinitely."
348                },
349                {
350                    "name": "tv_usec",
351                    "type": "Int32",
352                    "value": "0"
353                }
354            ]
355        },
356        {
357            "name": "socket_server",
358            "flags": [
359            ],
360            "return": {
361                "type": "Variant"
362            },
363            "args": [
364                {
365                    "name": "hostname",
366                    "type": "String"
367                },
368                {
369                    "name": "port",
370                    "type": "Int32",
371                    "value": "-1"
372                },
373                {
374                    "name": "errnum",
375                    "type": "Variant",
376                    "value": "null",
377                    "ref": true
378                },
379                {
380                    "name": "errstr",
381                    "type": "Variant",
382                    "value": "null",
383                    "ref": true
384                }
385            ]
386        },
387        {
388            "name": "socket_accept",
389            "desc": "After the socket socket has been created using socket_create(), bound to a name with socket_bind(), and told to listen for connections with socket_listen(), this function will accept incoming connections on that socket. Once a successful connection is made, a new socket resource is returned, which may be used for communication. If there are multiple connections queued on the socket, the first will be used. If there are no pending connections, socket_accept() will block until a connection becomes present. If socket has been made non-blocking using socket_set_blocking() or socket_set_nonblock(), FALSE will be returned.\n\nThe socket resource returned by socket_accept() may not be used to accept new connections. The original listening socket socket, however, remains open and may be reused.",
390            "flags": [
391            ],
392            "return": {
393                "type": "Variant",
394                "desc": "Returns a new socket resource on success, or FALSE on error. The actual error code can be retrieved by calling socket_last_error(). This error code may be passed to socket_strerror() to get a textual explanation of the error."
395            },
396            "args": [
397                {
398                    "name": "socket",
399                    "type": "Resource",
400                    "desc": "A valid socket resource created with socket_create()."
401                }
402            ]
403        },
404        {
405            "name": "socket_read",
406            "desc": "The function socket_read() reads from the socket resource socket created by the socket_create() or socket_accept() functions.",
407            "flags": [
408            ],
409            "return": {
410                "type": "Variant",
411                "desc": "socket_read() returns the data as a string on success, or FALSE on error (including if the remote host has closed the connection). The error code can be retrieved with socket_last_error(). This code may be passed to socket_strerror() to get a textual representation of the error.\n\nsocket_read() returns a zero length string (\"\") when there is no more data to read."
412            },
413            "args": [
414                {
415                    "name": "socket",
416                    "type": "Resource",
417                    "desc": "A valid socket resource created with socket_create() or socket_accept()."
418                },
419                {
420                    "name": "length",
421                    "type": "Int32",
422                    "desc": "The maximum number of bytes read is specified by the length parameter. Otherwise you can use \\r, \\n, or \\0 to end reading (depending on the type parameter, see below)."
423                },
424                {
425                    "name": "type",
426                    "type": "Int32",
427                    "value": "0",
428                    "desc": "Optional type parameter is a named constant: PHP_BINARY_READ (Default) - use the system recv() function. Safe for reading binary data. PHP_NORMAL_READ - reading stops at \\n or \\r."
429                }
430            ]
431        },
432        {
433            "name": "socket_write",
434            "desc": "The function socket_write() writes to the socket from the given buffer.",
435            "flags": [
436            ],
437            "return": {
438                "type": "Variant",
439                "desc": "Returns the number of bytes successfully written to the socket or FALSE on failure. The error code can be retrieved with socket_last_error(). This code may be passed to socket_strerror() to get a textual explanation of the error.\n\nIt is perfectly valid for socket_write() to return zero which means no bytes have been written. Be sure to use the === operator to check for FALSE in case of an error."
440            },
441            "args": [
442                {
443                    "name": "socket",
444                    "type": "Resource"
445                },
446                {
447                    "name": "buffer",
448                    "type": "String",
449                    "desc": "The buffer to be written."
450                },
451                {
452                    "name": "length",
453                    "type": "Int32",
454                    "value": "0",
455                    "desc": "The optional parameter length can specify an alternate length of bytes written to the socket. If this length is greater then the buffer length, it is silently truncated to the length of the buffer."
456                }
457            ]
458        },
459        {
460            "name": "socket_send",
461            "desc": "The function socket_send() sends len bytes to the socket socket from buf.",
462            "flags": [
463            ],
464            "return": {
465                "type": "Variant",
466                "desc": "socket_send() returns the number of bytes sent, or FALSE on error."
467            },
468            "args": [
469                {
470                    "name": "socket",
471                    "type": "Resource",
472                    "desc": "A valid socket resource created with socket_create() or socket_accept()."
473                },
474                {
475                    "name": "buf",
476                    "type": "String",
477                    "desc": "A buffer containing the data that will be sent to the remote host."
478                },
479                {
480                    "name": "len",
481                    "type": "Int32",
482                    "desc": "The number of bytes that will be sent to the remote host from buf."
483                },
484                {
485                    "name": "flags",
486                    "type": "Int32",
487                    "desc": "The value of flags can be any combination of the following flags, joined with the binary OR (|) operator. Possible values for flags MSG_OOB Send OOB (out-of-band) data. MSG_EOR Indicate a record mark. The sent data completes the record. MSG_EOF Close the sender side of the socket and include an appropriate notification of this at the end of the sent data. The sent data completes the transaction. MSG_DONTROUTE Bypass routing, use direct interface."
488                }
489            ]
490        },
491        {
492            "name": "socket_sendto",
493            "desc": "The function socket_sendto() sends len bytes from buf through the socket socket to the port at the address addr.",
494            "flags": [
495            ],
496            "return": {
497                "type": "Variant",
498                "desc": "socket_sendto() returns the number of bytes sent to the remote host, or FALSE if an error occurred."
499            },
500            "args": [
501                {
502                    "name": "socket",
503                    "type": "Resource",
504                    "desc": "A valid socket resource created using socket_create()."
505                },
506                {
507                    "name": "buf",
508                    "type": "String",
509                    "desc": "The sent data will be taken from buffer buf."
510                },
511                {
512                    "name": "len",
513                    "type": "Int32",
514                    "desc": "len bytes from buf will be sent."
515                },
516                {
517                    "name": "flags",
518                    "type": "Int32",
519                    "desc": "The value of flags can be any combination of the following flags, joined with the binary OR (|) operator. Possible values for flags MSG_OOB Send OOB (out-of-band) data. MSG_EOR Indicate a record mark. The sent data completes the record. MSG_EOF Close the sender side of the socket and include an appropriate notification of this at the end of the sent data. The sent data completes the transaction. MSG_DONTROUTE Bypass routing, use direct interface."
520                },
521                {
522                    "name": "addr",
523                    "type": "String",
524                    "desc": "IP address of the remote host."
525                },
526                {
527                    "name": "port",
528                    "type": "Int32",
529                    "value": "-1",
530                    "desc": "port is the remote port number at which the data will be sent."
531                }
532            ]
533        },
534        {
535            "name": "socket_recv",
536            "desc": "The socket_recv() function receives len bytes of data in buf from socket. socket_recv() can be used to gather data from connected sockets. Additionally, one or more flags can be specified to modify the behaviour of the function.\n\nbuf is passed by reference, so it must be specified as a variable in the argument list. Data read from socket by socket_recv() will be returned in buf.",
537            "flags": [
538            ],
539            "return": {
540                "type": "Variant",
541                "desc": "socket_recv() returns the number of bytes received, or FALSE if there was an error. The actual error code can be retrieved by calling socket_last_error(). This error code may be passed to socket_strerror() to get a textual explanation of the error."
542            },
543            "args": [
544                {
545                    "name": "socket",
546                    "type": "Resource",
547                    "desc": "The socket must be a socket resource previously created by socket_create()."
548                },
549                {
550                    "name": "buf",
551                    "type": "Variant",
552                    "desc": "The data received will be fetched to the variable specified with buf. If an error occurs, if the connection is reset, or if no data is available, buf will be set to NULL.",
553                    "ref": true
554                },
555                {
556                    "name": "len",
557                    "type": "Int32",
558                    "desc": "Up to len bytes will be fetched from remote host."
559                },
560                {
561                    "name": "flags",
562                    "type": "Int32",
563                    "desc": "The value of flags can be any combination of the following flags, joined with the binary OR (|) operator. Possible values for flags Flag Description MSG_OOB Process out-of-band data. MSG_PEEK Receive data from the beginning of the receive queue without removing it from the queue. MSG_WAITALL Block until at least len are received. However, if a signal is caught or the remote host disconnects, the function may return less data. MSG_DONTWAIT With this flag set, the function returns even if it would normally have blocked."
564                }
565            ]
566        },
567        {
568            "name": "socket_recvfrom",
569            "desc": "The socket_recvfrom() function receives len bytes of data in buf from name on port port (if the socket is not of type AF_UNIX) using socket. socket_recvfrom() can be used to gather data from both connected and unconnected sockets. Additionally, one or more flags can be specified to modify the behaviour of the function.\n\nThe name and port must be passed by reference. If the socket is not connection-oriented, name will be set to the internet protocol address of the remote host or the path to the UNIX socket. If the socket is connection-oriented, name is NULL. Additionally, the port will contain the port of the remote host in the case of an unconnected AF_INET or AF_INET6 socket.",
570            "flags": [
571            ],
572            "return": {
573                "type": "Variant",
574                "desc": "socket_recvfrom() returns the number of bytes received, or FALSE if there was an error. The actual error code can be retrieved by calling socket_last_error(). This error code may be passed to socket_strerror() to get a textual explanation of the error."
575            },
576            "args": [
577                {
578                    "name": "socket",
579                    "type": "Resource",
580                    "desc": "The socket must be a socket resource previously created by socket_create()."
581                },
582                {
583                    "name": "buf",
584                    "type": "Variant",
585                    "desc": "The data received will be fetched to the variable specified with buf.",
586                    "ref": true
587                },
588                {
589                    "name": "len",
590                    "type": "Int32",
591                    "desc": "Up to len bytes will be fetched from remote host."
592                },
593                {
594                    "name": "flags",
595                    "type": "Int32",
596                    "desc": "The value of flags can be any combination of the following flags, joined with the binary OR (|) operator. Possible values for flags Flag Description MSG_OOB Process out-of-band data. MSG_PEEK Receive data from the beginning of the receive queue without removing it from the queue. MSG_WAITALL Block until at least len are received. However, if a signal is caught or the remote host disconnects, the function may return less data. MSG_DONTWAIT With this flag set, the function returns even if it would normally have blocked."
597                },
598                {
599                    "name": "name",
600                    "type": "Variant",
601                    "desc": "If the socket is of the type AF_UNIX type, name is the path to the file. Else, for unconnected sockets, name is the IP address of, the remote host, or NULL if the socket is connection-oriented.",
602                    "ref": true
603                },
604                {
605                    "name": "port",
606                    "type": "Variant",
607                    "value": "-1",
608                    "desc": "This argument only applies to AF_INET and AF_INET6 sockets, and specifies the remote port from which the data is received. If the socket is connection-oriented, port will be NULL.",
609                    "ref": true
610                }
611            ]
612        },
613        {
614            "name": "socket_shutdown",
615            "desc": "The socket_shutdown() function allows you to stop incoming, outgoing or all data (the default) from being sent through the socket",
616            "flags": [
617            ],
618            "return": {
619                "type": "Boolean",
620                "desc": "Returns TRUE on success or FALSE on failure."
621            },
622            "args": [
623                {
624                    "name": "socket",
625                    "type": "Resource",
626                    "desc": "A valid socket resource created with socket_create()."
627                },
628                {
629                    "name": "how",
630                    "type": "Int32",
631                    "value": "0",
632                    "desc": "The value of how can be one of the following: possible values for how 0 Shutdown socket reading 1 Shutdown socket writing 2 Shutdown socket reading and writing"
633                }
634            ]
635        },
636        {
637            "name": "socket_close",
638            "desc": "socket_close() closes the socket resource given by socket. This function is specific to sockets and cannot be used on any other type of resources.",
639            "flags": [
640            ],
641            "return": {
642                "type": null,
643                "desc": "No value is returned."
644            },
645            "args": [
646                {
647                    "name": "socket",
648                    "type": "Resource",
649                    "desc": "A valid socket resource created with socket_create() or socket_accept()."
650                }
651            ]
652        },
653        {
654            "name": "socket_strerror",
655            "desc": "socket_strerror() takes as its errno parameter a socket error code as returned by socket_last_error() and returns the corresponding explanatory text.\n\nAlthough the error messages generated by the socket extension are in English, the system messages retrieved with this function will appear depending on the current locale (LC_MESSAGES).",
656            "flags": [
657            ],
658            "return": {
659                "type": "String",
660                "desc": "Returns the error message associated with the errno parameter."
661            },
662            "args": [
663                {
664                    "name": "errnum",
665                    "type": "Int32",
666                    "desc": "A valid socket error number, likely produced by socket_last_error()."
667                }
668            ]
669        },
670        {
671            "name": "socket_last_error",
672            "desc": "If a socket resource is passed to this function, the last error which occurred on this particular socket is returned. If the socket resource is omitted, the error code of the last failed socket function is returned. The latter is particularly helpful for functions like socket_create() which don't return a socket on failure and socket_select() which can fail for reasons not directly tied to a particular socket. The error code is suitable to be fed to socket_strerror() which returns a string describing the given error code.",
673            "flags": [
674            ],
675            "return": {
676                "type": "Int64",
677                "desc": "This function returns a socket error code."
678            },
679            "args": [
680                {
681                    "name": "socket",
682                    "type": "Resource",
683                    "value": "null_resource",
684                    "desc": "A valid socket resource created with socket_create()."
685                }
686            ]
687        },
688        {
689            "name": "socket_clear_error",
690            "desc": "This function clears the error code on the given socket or the global last socket error if no socket is specified.\n\nThis function allows explicitly resetting the error code value either of a socket or of the extension global last error code. This may be useful to detect within a part of the application if an error occurred or not.",
691            "flags": [
692            ],
693            "return": {
694                "type": null,
695                "desc": "No value is returned."
696            },
697            "args": [
698                {
699                    "name": "socket",
700                    "type": "Resource",
701                    "value": "null_resource",
702                    "desc": "A valid socket resource created with socket_create()."
703                }
704            ]
705        },
706        {
707            "name": "getaddrinfo",
708            "flags": [
709            ],
710            "return": {
711                "type": "Variant"
712            },
713            "args": [
714                {
715                    "name": "host",
716                    "type": "String"
717                },
718                {
719                    "name": "port",
720                    "type": "String"
721                },
722                {
723                    "name": "family",
724                    "type": "Int32",
725                    "value": "0"
726                },
727                {
728                    "name": "socktype",
729                    "type": "Int32",
730                    "value": "0"
731                },
732                {
733                    "name": "protocol",
734                    "type": "Int32",
735                    "value": "0"
736                },
737                {
738                    "name": "flags",
739                    "type": "Int32",
740                    "value": "0"
741                }
742            ]
743        }
744    ],
745    "classes": [
746    ]
747}