user31831: From Arduino code, I have a question for SoftwareSerial Class 
First: when I use more example for Esp8266 those functions use while loop to read response string from Esp when we send AT_Command to ESP. 
getResponse(const uint32_t  wait) {
    String tmpData = "";
    long int time = millis();
    while ((time + wait) > millis()) {
        while (esp8266->available() > 0) {
            char c = esp8266->read();
            if (c == '\0') continue;
            tmpData += c;
        }
    }   
    tmpData.trim();
    return tmpData;
}

I know that SoftwareSerial Class have a public method is readString() then I'm tried to use that and it return same result returned by while loop read:
getResponse(const uint32_t  wait) {
    String tmpData = "";
    tmpData = esp8266->readString();
    return tmpData;
}

Thanks for any. I'm working on improving my Eng.
Regards

user4143: Your while loop reads all the characters up until it reaches character 0 (it also has a timeout, although the timeout has been coded wrong since it can't deal with clock rollover). The .readString() method reads characters until no characters arrive within a timeout period (1s if memory serves me correctly).
Your while loop is the more reliable method since it uses a specific delimiter to identify blocks of data (strings) rather than assuming that:

The string will all arrive with no delays greater than the timeout
The strings will be sent with a gap of at least the timeout length between them.

Personally I would never recommend using any of the "helpful" functions provided for reading from a Stream object other than the basic .read() function.

31831: <p>From Arduino code, I have a question for SoftwareSerial Class </p>

<p>First: when I use more example for Esp8266 those functions use while loop to read response string from Esp when we send AT_Command to ESP. </p>

<pre><code>getResponse(const uint32_t  wait) {
    String tmpData = "";
    long int time = millis();
    while ((time + wait) &gt; millis()) {
        while (esp8266-&gt;available() &gt; 0) {
            char c = esp8266-&gt;read();
            if (c == '\0') continue;
            tmpData += c;
        }
    }   
    tmpData.trim();
    return tmpData;
}
</code></pre>

<p>I know that SoftwareSerial Class have a public method is <strong>readString()</strong> then I'm tried to use that and it return same result returned by while loop read:</p>

<pre><code>getResponse(const uint32_t  wait) {
    String tmpData = "";
    tmpData = esp8266-&gt;readString();
    return tmpData;
}
</code></pre>

<p>Thanks for any. I'm working on improving my Eng.
Regards</p>
 4143: <p>Your <code>while</code> loop reads all the characters up until it reaches character 0 (it also has a timeout, although the timeout has been coded wrong since it can't deal with clock rollover). The <code>.readString()</code> method reads characters until no characters arrive within a timeout period (1s if memory serves me correctly).</p>

<p>Your <code>while</code> loop is the more reliable method since it uses a specific delimiter to identify blocks of data (strings) rather than assuming that:</p>

<ol>
<li>The string will all arrive with no delays greater than the timeout</li>
<li>The strings will be sent with a gap of at least the timeout length between them.</li>
</ol>

<p>Personally I would never recommend using any of the "helpful" functions provided for reading from a <code>Stream</code> object other than the basic <code>.read()</code> function.</p>
