title: How does paramiko Channel.recv() exactly work?
body: <p>I'm having a hard time understanding how the <code>recv()</code> function works.</p>
  
  <p><a href="http://docs.paramiko.org/en/1.13/api/channel.html#paramiko.channel.Channel.recv" rel="nofollow">http://docs.paramiko.org/en/1.13/api/channel.html#paramiko.channel.Channel.recv</a></p>
  
  <p>I understand this is receiving a chunk a data each time you call the function, but can someone elaborate on the structure or size of this data? Lets say I send a command <code>date</code>, I notice:</p>
  
  <ul>
  <li>1st read gets: "date"</li>
  <li>2nd read gets: actual response (Mon Jun  9 12:04:17 CDT 2014)</li>
  <li>3rd read gets: prompt</li>
  </ul>
  
  <p>But how does this handle debugging messages that appear randomly on the terminal?</p>
  
  <p>Does the previous pattern hold true as long as the actual response is less than maximum bytes (<code>nbytes</code>)?</p>
  
  <p>What happens if it exceeds <code>nbytes</code>?</p>
  
  <p>As per request, I've added a snippet of the code below:</p>
  
  <pre><code>while reads&lt;maxReads:
     resp = self.__chan.recv(maxBytes)
     print resp
     self.__buffer += resp
     if resp.endswith('$ ') or resp.endswith('# '):
        break
     reads += 1
  </code></pre>