0
The following code, allows only one client and not several at the same time. It is possible to create something, leaves multiple connected clients?
$socket = socket_create( AF_INET , SOCK_STREAM , SOL_TCP );
socket_bind( $socket , 'localhost' , '2000' );
socket_listen( $socket );
while ( true ) {
$client = socket_accept( $socket );
socket_write( $client , 'Aê! Seja bem-vindo!' );
}
In fact There are several sockets in that code. But is this a real study or application? Because it’s not very common to use sockets in PHP. Nor is it the best language to handle them.
– bfavaretto