def recv(self, nbytes):
try:<EOL><INDENT>out = self.in_buffer.read(nbytes, self.timeout)<EOL><DEDENT>except PipeTimeout:<EOL><INDENT>raise socket.timeout()<EOL><DEDENT>ack = self._check_add_window(len(out))<EOL>if ack > <NUM_LIT:0>:<EOL><INDENT>m = Message()<EOL>m.add_byte(cMSG_CHANNEL_WINDOW_ADJUST)<EOL>m.add_int(self.remote_chanid)<EOL>m.add_int(ack)<EOL>self.transport._send_user_message(m)<EOL><DEDENT>return out<EOL>
Receive data from the channel.  The return value is a string
representing the data received.  The maximum amount of data to be
received at once is specified by ``nbytes``.  If a string of
length zero is returned, the channel stream has closed.

:param int nbytes: maximum number of bytes to read.
:return: received data, as a ``str``/``bytes``.

:raises socket.timeout:
    if no data is ready before the timeout set by `settimeout`.