I think php sockets and php streams are overlapping each other.
I\'ve managed to make a CLI PHP chat client and a server, using either sockets or streams.
Here som
According to the manual, the sockets extension is more low-level. For instance, whith sockets you have finer-grained control when creating one, and can choose SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET, etc.
The socket extension implements a low-level interface to the socket communication functions based on the popular BSD sockets, providing the possibility to act as a socket server as well as a client.
For a more generic client-side socket interface, see stream_socket_client(), stream_socket_server(), fsockopen(), and pfsockopen().
source: http://www.php.net/manual/en/intro.sockets.php