PHP 8.5.0 Alpha 1 available for testing

Voting

: seven plus two?
(Example: nine)

The Note You're Voting On

Vasil Rangelov a.k.a. boen_robot
13 years ago
The remote_socket argument, in its end (well... after the port), can also contain a "/" followed by a unique identifier. This is especially useful if you want to create multiple persistent connections to the same transport://host:port combo.

Example:
<?php
$socket
= stream_socket_client('tcp://mysql.example.com:3306/root', $errorno, $errorstr, $timeout, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT);
?>

Note that while (p)fsockopen() follows a similar scheme, it doesn't have this particular feature.

<< Back to user notes page

To Top