Bonjour,

J'essaie d'utiliser l'api CLING pour utiliser l'upnp. J'en suis pour le moment à la découverte de service.
Lorsque je désactive le pare-feu, je découvre très bien ma freebox.
Le problème c'est que j'ai bien ouvert le port 1900 (pour l'upnp) un port 18040 que j'ai configuré, mais dans mes log du pare-feu, un autre port aléatoire est utilisé, mais pas moyen de la configurer.
Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
public void searchRenderer() {
		final UpnpService upnpService=new UpnpServiceImpl(new DefaultUpnpServiceConfiguration(18040),new DefaultRegistryListener(){
			@Override
			public void remoteDeviceAdded(Registry registry, RemoteDevice device){
				getModel().addRenderer(device);
			}
		});
 
		upnpService.getControlPoint().search(new UDADeviceTypeHeader(new UDADeviceType("MediaRenderer")));
		new Thread(){
			@Override
			public void run(){
				for (int i=0;i<=100;i++){
					try {
						sleep(100);
						getModel().setMilliSecondElapsed(i*100);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
				upnpService.shutdown();
 
			}
 
		}.start();
	}
Voici ce que j'ai sur la console :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
nov. 23, 2014 7:32:40 PM org.fourthline.cling.UpnpServiceImpl <init>
INFOS: >>> Starting UPnP service...
nov. 23, 2014 7:32:40 PM org.fourthline.cling.UpnpServiceImpl <init>
INFOS: Using configuration: org.fourthline.cling.DefaultUpnpServiceConfiguration
nov. 23, 2014 7:32:40 PM org.fourthline.cling.transport.RouterImpl <init>
INFOS: Creating Router: org.fourthline.cling.transport.RouterImpl
nov. 23, 2014 7:32:40 PM org.fourthline.cling.transport.impl.MulticastReceiverImpl init
INFOS: Creating wildcard socket (for receiving multicast datagrams) on port: 1900
nov. 23, 2014 7:32:40 PM org.fourthline.cling.transport.impl.MulticastReceiverImpl init
INFOS: Joining multicast group: /239.255.255.250:1900 on network interface: wlan0
nov. 23, 2014 7:32:40 PM org.fourthline.cling.transport.impl.StreamServerImpl init
INFOS: Created server (for receiving TCP streams) on: /192.168.0.10:18040
nov. 23, 2014 7:32:40 PM org.fourthline.cling.transport.impl.DatagramIOImpl init
INFOS: Creating bound socket (for datagram input/output) on: /192.168.0.10
nov. 23, 2014 7:32:40 PM org.fourthline.cling.UpnpServiceImpl <init>
INFOS: <<< UPnP service started successfully
nov. 23, 2014 7:32:51 PM org.fourthline.cling.UpnpServiceImpl$1 run
INFOS: >>> Shutting down UPnP service...
nov. 23, 2014 7:32:52 PM org.fourthline.cling.UpnpServiceImpl$1 run
INFOS: <<< UPnP service shutdown completed