I find it difficult to understand how the recv() function works.
http://docs.paramiko.org/en/1.13/api/channel.html#paramiko.channel.Channel.recv
I understand that every time you call this function, it gets a piece of data, but can anyone clarify the structure or size of this data? Say I send a date command, 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 to handle debugging messages that appear randomly on the terminal?
Is the previous template preserved if the actual response is less than the maximum byte ( nbytes )?
What happens if it exceeds nbytes ?
As requested, I added a code snippet below:
while reads<maxReads: resp = self.__chan.recv(maxBytes) print resp self.__buffer += resp if resp.endswith('$ ') or resp.endswith('# '): break reads += 1
source share