B4J Question upnp server / discovery II

madru

Active Member
Licensed User
Longtime User
I have done a little POC for UPnP discovery

both sides do work really well on Windows but trying the server on Linux or macOS the
B4X:
 udp_PacketArrived
event is not raised.

can somebody confirm this issues, client and server are attached

there is of course the possibility that the few lines of code are the problem ;)
 

Attachments

  • upnp-client.zip
    1.1 KB · Views: 241
  • upnp-server-cli.zip
    1.7 KB · Views: 248

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
hi! both works for me on linux arch (server on release mode and client on debug)
client
1623861824213.png


server
1623861852545.png
 
Upvote 0

madru

Active Member
Licensed User
Longtime User
Hi Enrique, thx for the feedback ..... big Mysterium :(

I can't get it to work here. Flat network , no firewall etc on the Linux, OSX machine.....


sometimes I can see "NOTIFY" messages from the Sonos speaker here in the office.

B4X:
NOTIFY * HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age = 1800
LOCATION: http://192.168.1.13:1400/xml/device_description.xml
NT: upnp:rootdevice
NTS: ssdp:alive
SERVER: Linux UPnP/1.0 Sonos/63.2-89260 (ZPS22)
USN: uuid:RINCON_*****************::upnp:rootdevice
X-RINCON-HOUSEHOLD: Sonos_**************************
X-RINCON-BOOTSEQ: 12
BOOTID.UPNP.ORG: 12
X-RINCON-WIFIMODE: 1
X-RINCON-VARIANT: 1
HOUSEHOLD.SMARTSPEAKER.AUDIO: Sonos_**************************.kod19***************

no idea why the socket is not listening properly, nmap shows that the port is open:

B4X:
sudo nmap -sU  192.168.1.129
Starting Nmap 7.80 ( https://nmap.org ) at 2021-06-17 08:19 CEST
Nmap scan report for db (192.168.1.129)
Host is up (0.000041s latency).
Not shown: 997 closed ports
PORT      STATE         SERVICE
68/udp    open|filtered dhcpc
1900/udp  open         upnp
10000/udp open          ndmp

Nmap done: 1 IP address (1 host up) scanned in 1.45 seconds

who has an idea?


THX
 
Upvote 0

madru

Active Member
Licensed User
Longtime User
1 step closer ......

it is somehow related to multiple interfaces on those machines (1 x physical & 1 x OVPN)

if I bring down the OVPN Interface the 'poc-server' replies as expected

what I don't understand: why does the 'poc-server' 'see' to the Sonos devices as mentioned before if both interfaces are enabled ????

both interfaces enabled on 'server':
packet received event is not raised using my little poc client or echo -n 1234567890| ncat -vu 239.255.255.250 1900
packet received event is raised by 'NOTIFY' message from the Sonos device

disabling the OVPN interface:
packet received event is raised with my little poc client or echo -n 1234567890| ncat -vu 239.255.255.250 1900
packet received event is raised raised by 'NOTIFY' message from the Sonos device


is it possible that the
B4X:
anywheresoftware.b4a.objects.SocketWrapper.UDPSocket
does not listen on multiple interfaces correctly ? is it possible to define the listening interface ?
 
Upvote 0
Top