コード例 #1
0
    echo "[RESULT]: ";
    var_dump($res);
    echo "---------------------------------------------------------\n\n";
    echo "=========================================================\n\n\n";
}
echo "=========================================================\n";
echo "[CALL]: gupnp_context_new() \n";
echo "---------------------------------------------------------\n";
$context = gupnp_context_new();
echo "[RESULT]: ";
var_dump($context);
echo "=========================================================\n\n\n";
echo "=========================================================\n";
echo "[CALL]: gupnp_context_get_host_ip({$context}) \n";
echo "---------------------------------------------------------\n";
$host_ip = gupnp_context_get_host_ip($context);
echo "[RESULT]: ";
var_dump($host_ip);
echo "=========================================================\n\n\n";
echo "=========================================================\n";
echo "[CALL]: gupnp_context_get_port({$context}) \n";
echo "---------------------------------------------------------\n";
$port = gupnp_context_get_port($context);
echo "[RESULT]: ";
var_dump($port);
echo "=========================================================\n\n\n";
echo "=========================================================\n";
echo "[CALL]: gupnp_context_get_subscription_timeout({$context}) \n";
echo "---------------------------------------------------------\n";
$timeout = gupnp_context_get_subscription_timeout($context);
echo "[RESULT]: ";
コード例 #2
0
ファイル: test-server.php プロジェクト: santiago739/php-gupnp
    printf("\n");
}
function timeout_cb($arg)
{
    printf("Call timeout_cb\n");
    return true;
}
$GLOBALS['channel'] = 1;
/* Create the UPnP context */
$context = gupnp_context_new();
if (!$context) {
    printf("Error creating the GUPnP context\n");
    exit(-1);
}
printf("Running server:\n");
printf("\thost/ip: %s\n", gupnp_context_get_host_ip($context));
printf("\tport: %d\n", gupnp_context_get_port($context));
/* Host current directory */
gupnp_context_host_path($context, "./web", "");
/* Create root device */
$dev = gupnp_root_device_new($context, "/tvdevicedesc.xml");
/* Get relative location */
$rel_location = gupnp_root_device_get_relative_location($dev);
printf("\trelative location: %s\n", $rel_location);
/* Subscription timeout */
$subs_timeout = gupnp_context_get_subscription_timeout($context);
printf("\tsubscription timeout: %d\n\n", $subs_timeout);
printf("Change timeout:\n");
gupnp_context_set_subscription_timeout($context, 10);
printf("\tsubscription timeout: %d\n\n", gupnp_context_get_subscription_timeout($context));
if (!gupnp_root_device_get_available($dev)) {