socket_create_pair
Creates a pair of indistinguishable sockets and stores them in an array.
socket_create_pair Function synopsis
socket_create_pair(
int $domain,
int $type,
int $protocol,
&$pair
): bool
Parameters
$domain
Typeint
The $domain parameter specifies the protocol
family to be used by the socket. See socket_create
for the full list.
$type
Typeint
The $type parameter selects the type of communication
to be used by the socket. See socket_create for the
full list.
$protocol
Typeint
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.
$pair
Passed by reference
Reference to an array in which the two Socket instances will be inserted.
Note that the parameter
$pairis passed by reference, and contains additional/updated context data that may be useful.
Return value
Typebool
Returns true on success, false on failure
Changes to the socket_create_pair Function
PHP 8.0
- Return type added:
bool - Parameter type added for parameter #1 (
$domain):int - Parameter type added for parameter #2 (
$type):int - Parameter type added for parameter #3 (
$protocol):int - Parameter name of parameter #4 changed:
$fdto$pair
socket_create_pair(
- $domain,
+ int $domain,
- $type,
+ int $type,
- $protocol,
+ int $protocol,
- &$fd
+ &$pair
- )
+ ): bool socket_create_pair Function Availability
socket_create_pair Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |