mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-08 16:11:18 +00:00
Obtain IP adress for MDNS automatically
This commit is contained in:
1 parent
44ef3b43d2
commit
0c794f19d2
8 files changed
+193
-85
No files matched your search
@@ -15,7 +15,6 @@ static void mdns_ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
uint32_t response_ip = inet_addr("192.168.69.11");
|
||||
struct mg_mgr mgr;
|
||||
static struct mg_connection *c;
|
||||
mg_log_set(MG_LL_DEBUG); // Set log level
|
||||
@@ -24,10 +23,6 @@ int main(void) {
|
||||
// Desired name must NOT have any dots in it, nor a domain
|
||||
c = mg_mdns_listen(&mgr, mdns_ev_handler, "Mongoose"); // Start mDNS server
|
||||
if (c == NULL) return 1;
|
||||
// if not using our built-in TCP/IP stack, pass the IP address you want to
|
||||
// use as a response, this depends on your underlying TCP/IP stack and number
|
||||
// of interfaces available
|
||||
memcpy(c->data, &response_ip, sizeof(response_ip));
|
||||
if (!mg_mdns_query(c, s_theone, MG_DNS_RTYPE_A)) return 1;
|
||||
|
||||
for (;;) mg_mgr_poll(&mgr, 1000); // Event loop
|
||||
|
||||
Reference in new issue
Block a user