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

Ingo bm.530502 at gmail.com
Sun Oct 29 21:09:25 CET 2017


Am 29.10.2017 um 20:10 schrieb Tobias Boege:
> On Sun, 29 Oct 2017, Ingo wrote:
>> Am 29.10.2017 um 18:39 schrieb Tobias Boege:
>>> 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).
>> Yes, that's maybe true. I have not found an example anywhere with curl?!
>>
>>> 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 know about the CRLF. Even the last line has one. I've tried it with \n\r,
>> \r\n and gb.CrLf.
>>> I would just use the UdpSocket from gb.net to send these requests.
>> Hi Tobi,
>> thanks for your reply. Do you have an approach with udpsocket?
>>
> See the attached script. The UdpSocket interface looks a little weird
> with the manual Watch method. I don't think I've used it before, and
> I don't know if the script is working, as I get no response on the
> network here, but at least the code throws no error.
>
> Regards,
> Tobi
>
>
That's great :-P

With three small modifications it works - partially
Because not all of the devices were found, just one of them.

  $hUdp.EndOfLine = gb.Windows    ' has to be set

' $hUdp.Watch(gb.Read, True)     ' (does not work)

Write #$hUdp, "ST: ssdp:all\r\n\r\n"  ' a second CrLf


"gssdp-discover -i wlan0 --timeout=3" finds all devices. Especially the 
router (FritzBox).


But thanks for that.
Greetings
Ingo





More information about the User mailing list