gupnp_context_new only allow you to use a specific network interface, not an ip address.
In gupnp-context.c we get :
gupnp_context_new (GMainContext *main_context, const char *interface, guint port, GError **error)
with @interface: The network interface to use, or %NULL to auto-detect.
ie use $context = gupnp_context_new("eth0");
NOT $context = gupnp_context_new("1.2.3.4");
gupnp_context_new
(PECL gupnp >= 0.1.0)
gupnp_context_new — Crea un nuevo contexto
Descripción
resource gupnp_context_new
([ string
$host_ip
[, int $port = 0
]] )Crea un nuevo contexto con la ip y puerto específicado.
Parámetros
-
host_ip -
La dirección IP local, o NULL para usar la dirección IP de la primera interfaz de red sin loopback.
-
port -
Puerto a utilizar, o 0 si usted no le importa definir un puerto.
Valores devueltos
Un identificador de contexto.
Ejemplos
Ejemplo #1 Crea un nuevo contexto UPnP
<?php
/* Crea un nuevo contexto UPnP */
$context = gupnp_context_new();
if (!$context) {
die("Error creando el contexto GUPnP \n");
}
?>
Errores/Excepciones
Lanza un E_WARNING cuando es incapaz de crear un contexto.
flanker_forever at hotmail dot com
27-Apr-2012 09:04
