Esempio n. 1
0
            $this->send($socket, '{"action":"execute","command":"' . str_replace('\\', '/', $message) . '"}');
        }
    }
    public function getByType($type)
    {
        $clients = array();
        foreach ($this->connected as $client) {
            if ($client->type == $type) {
                $clients[] = $client;
            }
        }
        return $clients;
    }
    private $lastMessage;
}
$client = new ClientSocket('0.0.0.0', 9999, 20);
$client->start();
class ClientDevice
{
    public $id, $type, $socket, $location, $user;
}
/**
 * Class to handle a sockets server
 * It's abstract class so you need to create another class that will extends SocketServer to run your server
 * 
 * @author Cyril Mazur	www.cyrilmazur.com	twitter.com/CyrilMazur	facebook.com/CyrilMazur
 * @abstract
 */
abstract class SocketServer
{
    /**
 public function removeFromClientData(ClientSocket $Client)
 {
     unset($this->ClientData[$Client->getSocketName()]);
 }