From 6725d61b3f3fec7d4538ebf7b952da01603e41ac Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Fri, 7 Jan 2022 18:28:51 +0000 Subject: [PATCH] Re-init SSDP peer address before every search --- examples/udp-ssdp-search/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/udp-ssdp-search/main.c b/examples/udp-ssdp-search/main.c index 9171765e..7da13e33 100644 --- a/examples/udp-ssdp-search/main.c +++ b/examples/udp-ssdp-search/main.c @@ -14,6 +14,9 @@ static void tfn(void *param) { struct mg_connection *c = param; if (c == NULL) return; LOG(LL_INFO, ("Sending M-SEARCH")); + // Each response to the SSDP socket will change c->peer, so re-initialise + // c->peer to the multicast address before each search request + mg_resolve(c, s_ssdp_url); mg_printf(c, "%s", "M-SEARCH * HTTP/1.1\r\n" "HOST: 239.255.255.250:1900\r\n"