• The assignment MyIP=ip; is done in the callback. That's what's puzzling. The console.log(ip) is also done in the callback before the assignment and displays the IP address. It's likely a timing issue but still puzzling.

    I've got UDP working (not this example code). I broadcast using IP=255.255.255.255 and send a keyword and local IP address. If the keyword matches, the other end broadcasts using a keyword and it's local IP address. So I need the local IP address from the getIP function to finish this.
    Msg1: Hi I'm Billy Bob at IPxxx, where are you Sally?
    Msg2: Hi I'm Sally at IPyyy.
    Then Billy Bob can use IPyyy to contact Sally.
    Right now I'm hard coding the local IP addresses, but that defeats the purpose since the next time my router resets the IP addresses will be reassigned.

About