user57459: I am doing code of esp while switching hotspot for connecting esp i am getting some problem .
I am using this line of code:
while ((!esp.find("WIFI ")) || (!esp.find("+CWJAP:3")));

but it is not working. Anybody please give me alternate how to use this type of looping.

user37622: The find method reads the characters until the searched string is found or a timeout interval is passed.
In your case if the connection is not successful, the first find will not find "WIFI" and will read all the input including the "+CWJAP:3", then on timeout it returns false. The second find will wait until timeout and then return false.

57459: <p>I am doing code of esp while switching hotspot for connecting esp i am getting some problem .
I am using this line of code:</p>

<pre><code>while ((!esp.find("WIFI ")) || (!esp.find("+CWJAP:3")));
</code></pre>

<p>but it is not working. Anybody please give me alternate how to use this type of looping.</p>
 37622: <p>The <code>find</code> method reads the characters until the searched string is found or a timeout interval is passed.</p>

<p>In your case if the connection is not successful, <strong>the first <code>find</code></strong> will not find "WIFI" and <strong>will read all the input</strong> including the "+CWJAP:3", then on timeout it returns false. The second <code>find</code> will wait until timeout and then return false.</p>
