/** * Send a request * * @param string $host The client's IP to send the request to * @param integer $port The client's port number * @param string $message The message to send * * @throws Exception * @return string The client's response */ static function send($host, $port, $message) { $root_dir = dirname(__FILE__); include_once "{$root_dir}/SocketClient.class.php"; try { if (!self::$client) { self::$client = new SocketClient(); self::$client->connect($host, $port); } return self::$client->sendAndReceive($message); } catch (Exception $e) { throw $e; } }