code: def recv_msg(self):
          '''收取一个完整响应消息或ANNOUNCE通知消息'''
          try:
              while True:
                  if HEADER_END_STR in self._recv_buf: break
                  more = self._sock.recv(2048)
                  if not more: break
                  self._recv_buf += more
          except socket.error, e:
              PRINT('Receive data error: %s'%e,RED)
              sys.exit(-1)
  
          msg = ''
          if self._recv_buf:
              (msg,self._recv_buf) = self._recv_buf.split(HEADER_END_STR,1)
              content_length = self._get_content_length(msg)
              msg += HEADER_END_STR + self._recv_buf[:content_length]
              self._recv_buf = self._recv_buf[content_length:]
          return msf recv_msg(self):
          '''收取一个完整响应消息或ANNOUNCE通知消息'''
          try:
              while True:
                  if HEADER_END_STR in self._recv_buf: break
                  more = self._sock.recv(2048)
                  if not more: break
                  self._recv_buf += more
          except socket.error, e:
              PRINT('Receive data error: %s'%e,RED)
              sys.exit(-1)
  
          msg = ''
          if self._recv_buf:
              (msg,self._recv_buf) = self._recv_buf.split(HEADER_END_STR,1)
              content_length = self._get_content_length(msg)
              msg += HEADER_END_STR + self._recv_buf[:content_length]
              self._recv_buf = self._recv_buf[content_length:]
          return msg
docs: 收取一个完整响应消息或ANNOUNCE通知消息