def recv(self, n): self._buffer.seek(self._read_pos, io.SEEK_SET) bs = self._buffer.read(n) self._read_pos = self._buffer.tell() return bs