MDNS.begin

MDNS.begin ( addr -- fl )

mDNS, or multicast DNS, is a service that helps you find your wireless devices on the network without knowing their IP address. It is a standard protocol widely implemented for local printer discovery, wireless speakers, network storage devices etc. mDNS won’t let you find devices any where on the Internet, but mDNS can help if your sensor and computer are on the same local network.

Each device can advertise many service end-points and many devices may advertise the same type of end-point. Each device should have a unique name, so you can choose the one you want to connect to.

Call z" name" MDNS.begin to start the server. Here, name is the name that will identify your device on the network, so it should be unique.

: login ( z z -- )
    WIFI_MODE_STA Wifi.mode
    WiFi.begin 
    begin 
        WiFi.localIP 0= 
    while 
        100 ms 
    repeat 
    WiFi.localIP ip. cr
    z" forth" MDNS.begin 
    if      ." MDNS started" 
    else    ." MDNS failed" 
    then cr
    ;