10.2. Sockets
The socket functions send information directly over the Internet Protocol. They operate at a much lower level compared to fsockopen and streams. Generally, they wrap C functions of the same name. If you have experience programming for sockets in C, these functions will be familiar. A full discussion of sockets programming is out of scope.
Use of these functions implies solving a problem that the higher level functions can't address. In other words, it makes little sense to use these functions to implement functionality provided by fopen. You may find them most useful when using PHP in a nontraditional way, such as starting an Internet daemon from the CLI (command-line interface) version of PHP.
resource socket_accept(resource socket) ...
Get Core PHP Programming, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.