-->
Page 1 of 1

Calling UDP.begin() before connection is completed

PostPosted: Thu Dec 21, 2017 11:28 am
by FranckM
Can I call UDP.begin() before waiting on the WiFi to be properly connected? Most of the examples I see wait for the WiFi to connect, but I'm wondering if it's necessary.

For example, I would like to do this instead :

in setup() :

WiFi.mode(WIFI_STA); //Station mode
WiFi.disconnect();
WiFi.begin(APName,"12348756"); //Connect to AP
UDP.begin(localPort);

And check in loop() to blink the led for the connection status, allowing my main program to start running right away.

Thank you

Re: Calling UDP.begin() before connection is completed

PostPosted: Thu Dec 21, 2017 3:08 pm
by schufti
I don't know but why not just try out and report your findings?

Re: Calling UDP.begin() before connection is completed

PostPosted: Thu Dec 21, 2017 3:24 pm
by FranckM
schufti wrote:I don't know but why not just try out and report your findings?


That would be the smart thing to do :) I'm coding away from my shop at the moment, and I'm also open to any insight on this mechanic. I will report back though!

Re: Calling UDP.begin() before connection is completed

PostPosted: Wed Dec 27, 2017 12:27 pm
by FranckM
Reporting back. I tested this method and it works perfectly.