Aller au contenu

Client UPNP


Real

Recommended Posts

Bonjour je suis entrain de développer un client UPNP pour Android.

Au moment de la découverte mon application Android ne trouve aucuns devices, pourtant si j'exécute mon application en tant que Projet JAVA Application, je réussi bien à recupérer ma liste de devices.

Il y a t'il une configuration à faire sur l'Emulateur Android ? (redirection de port).

public class Wizard {

private DatagramSocket socket;

private DatagramPacket packet;

private InetAddress address;

private byte[] message;

private int port;

public Wizard() throws UnknownHostException {

address = InetAddress.getByName("239.255.255.250");;

message = new byte[1024];

port = 1900;

}

public ArrayList init_network() throws IOException {

String search = "M-SEARCH * HTTP/1.1\r\nHOST: 239.255.255.250:1900\r\nMAN: \"ssdp:discover\"\r\nMX: 1\r\nST: urn:schemas-upnp-org:device:MediaServer:1\r\n\r\n";

message = search.getBytes();

socket = new DatagramSocket();

packet = new DatagramPacket(message, message.length,address, port);

socket.send(packet);

ArrayList list_result = new ArrayList();

for (int i=0; i<15; i++){

socket.receive(packet);

String received = new String(packet.getData(), 0, packet.getLength());

list_result.add(received);

}

return list_result;

}

Merci d'avance pour vos réponses.

Lien vers le commentaire
Partager sur d’autres sites

  • 4 months later...

Avez-vous visité cette page ? Il pourrait y avoir des infos intéressantes :

http://teleal.org/projects/cling/

Extrait :

Cling - Java UPnP library and tools

Cling is an effort to create a UPnP-compatible software stack in Java. The project's goals are strict specification compliance, complete, clean and extensive APIs, as well as rich SPIs for easy extension.

The current release of Cling is 1.0-beta4 (2010-08-04), see the Changelog for a summary of improvements.

Main modules of Cling are:

Cling Core

An embeddable Java library that implements the UPnP Device Architecture 1.0. Use Cling Core to expose services with a UPnP remoting interface, or to write control point applications that discover UPnP devices and utilize their services. You can also integrate Cling Core as a UPnP/DLNA library in your Android applications (platform level 7/2.1 required).

Lien vers le commentaire
Partager sur d’autres sites

Rejoignez la conversation

Vous pouvez poster maintenant et vous enregistrez plus tard. Si vous avez un compte, connectez-vous maintenant pour poster.

Invité
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Répondre à ce sujet…

×   Collé en tant que texte enrichi.   Coller en tant que texte brut à la place

  Seulement 75 émoticônes maximum sont autorisées.

×   Votre lien a été automatiquement intégré.   Afficher plutôt comme un lien

×   Votre contenu précédent a été rétabli.   Vider l’éditeur

×   Vous ne pouvez pas directement coller des images. Envoyez-les depuis votre ordinateur ou insérez-les depuis une URL.

×
×
  • Créer...