def _read(self, n, initial=False, _errnos=(errno.EAGAIN, errno.EINTR)):
recv = self._quick_recv<EOL>rbuf = self._read_buffer<EOL>try:<EOL><INDENT>while len(rbuf) < n:<EOL><INDENT>try:<EOL><INDENT>s = recv(n - len(rbuf))<EOL><DEDENT>except socket.error as exc:<EOL><INDENT>if not initial and exc.errno in _errnos:<EOL><INDENT>continue<EOL><DEDENT>raise<EOL><DEDENT>if not s:<EOL><INDENT>raise IOError('<STR_LIT>')<EOL><DEDENT>rbuf += s<EOL><DEDENT><DEDENT>except:<EOL><INDENT>self._read_buffer = rbuf<EOL>raise<EOL><DEDENT>result, self._read_buffer = rbuf[:n], rbuf[n:]<EOL>return result<EOL>
Read exactly n bytes from the socket