@@ -45,6 +45,46 @@ function socket_accept($socket)
45
45
}
46
46
47
47
48
+ /**
49
+ * Create a Socket resource, and bind it to the provided AddrInfo resource. The return
50
+ * value of this function may be used with socket_listen.
51
+ *
52
+ * @param resource $addr Resource created from socket_addrinfo_lookup().
53
+ * @return resource|null Returns a Socket resource on success or NULL on failure.
54
+ * @throws SocketsException
55
+ *
56
+ */
57
+ function socket_addrinfo_bind ($ addr )
58
+ {
59
+ error_clear_last ();
60
+ $ result = \socket_addrinfo_bind ($ addr );
61
+ if ($ result === null ) {
62
+ throw SocketsException::createFromPhpError ();
63
+ }
64
+ return $ result ;
65
+ }
66
+
67
+
68
+ /**
69
+ * Create a Socket resource, and connect it to the provided AddrInfo resource. The return
70
+ * value of this function may be used with the rest of the socket functions.
71
+ *
72
+ * @param resource $addr Resource created from socket_addrinfo_lookup()
73
+ * @return resource|null Returns a Socket resource on success or NULL on failure.
74
+ * @throws SocketsException
75
+ *
76
+ */
77
+ function socket_addrinfo_connect ($ addr )
78
+ {
79
+ error_clear_last ();
80
+ $ result = \socket_addrinfo_connect ($ addr );
81
+ if ($ result === null ) {
82
+ throw SocketsException::createFromPhpError ();
83
+ }
84
+ return $ result ;
85
+ }
86
+
87
+
48
88
/**
49
89
* Binds the name given in address to the socket
50
90
* described by socket. This has to be done before
@@ -336,6 +376,25 @@ function socket_getsockname($socket, ?string &$addr, ?int &$port = null): void
336
376
}
337
377
338
378
379
+ /**
380
+ * Imports a stream that encapsulates a socket into a socket extension resource.
381
+ *
382
+ * @param resource $stream The stream resource to import.
383
+ * @return resource Returns FALSE or NULL on failure.
384
+ * @throws SocketsException
385
+ *
386
+ */
387
+ function socket_import_stream ($ stream )
388
+ {
389
+ error_clear_last ();
390
+ $ result = \socket_import_stream ($ stream );
391
+ if ($ result === null ) {
392
+ throw SocketsException::createFromPhpError ();
393
+ }
394
+ return $ result ;
395
+ }
396
+
397
+
339
398
/**
340
399
* After the socket socket has been created
341
400
* using socket_create and bound to a name with
0 commit comments