I'm having a hard time understanding how the recv()
function works.
http://docs.paramiko.org/en/1.13/api/channel.html#paramiko.channel.Channel.recv
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 date
, I notice:
- 1st read gets: "date"
- 2nd read gets: actual response (Mon Jun 9 12:04:17 CDT 2014)
- 3rd read gets: prompt
But how does this handle debugging messages that appear randomly on the terminal?
Does the previous pattern hold true as long as the actual response is less than maximum bytes (nbytes
)?
What happens if it exceeds nbytes
?
As per request, I've added a snippet of the code below:
while reads<maxReads:
resp = self.__chan.recv(maxBytes)
print resp
self.__buffer += resp
if resp.endswith('$ ') or resp.endswith('# '):
break
reads += 1