[Gambas-user] HowTo a M-Search (UPnP)

Tobias Boege taboege at gmail.com
Sun Oct 29 18:39:16 CET 2017


On Sun, 29 Oct 2017, Ingo wrote:
> Hello together,
> 
> I'd like to do a M-Search with Gamabs.
> 
> /http://www.upnp-hacks.org/upnp.html//
> //When a UPnP capable device joins a network and wants to know what UPnP
> services are available on the network, it sends out a discovery message to
> the multicast address 239.255.255.250 on port 1900 via the UDP protocol.
> This message contains a header, similar to a HTTP request. This protocol is
> sometimes referred to as HTTPU (HTTP over UDP)://
> ////
> //M-SEARCH * HTTP/1.1//
> //HOST: 239.255.255.250:1900//
> //MAN: ssdp:discover//
> //MX: 10//
> //ST: ssdp:all/
> 
> I tested with curl -K option but with no effect. Curl brings warnings like:
> Warning: upnp.txt:1: warning: 'M-SEARCH' uses unquoted white space in the
> line
> Warning: that may cause side-effects!
> Warning: upnp.txt:1: warning: 'M-SEARCH' had unsupported trailing garbage
> Warning: upnp.txt:2: warning: 'HOST' is badly used here
> 
> 
> Is it possible to do a M-Search request maybe with httpClient?
> 

I can't answer your question about HttpClient without looking into the
curl source code (maybe they support an "httpu://" schema, but I wouldn't
bet on it).

The key to the warnings you get would be your(?) upnp.txt file which
is read by "curl -K", yes? The warnings about trailing garbage could
come from a wrong EOL marker in that file. If HTTPU is like HTTP in
that regard, it will use the "windows" EOL sequence "\r\n".

I would just use the UdpSocket from gb.net to send these requests.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list