    def recv(self, bufsize, flag=0):
        '''
        @brief: 实现tcp的recv
        @param bufsize: 接收大小
        @type bufsize: int
        @param flag: 接收标志
        @param flag: int
        @return: 接收的内容，接收出错返回None
        @rtype: str
        '''
        tarsLogger.debug('TcpTransceiver:recv')
        assert(self.isValid())

        buf = ''
        try:
            buf = self.getSock().recv(bufsize, flag)
            if len(buf) == 0:
                tarsLogger.info('tcp recv, fd: %d, %s, recv 0 bytes, close',
                                self.getFd(), self.getEndPointInfo())
                self.close()
                return None
        except socket.error as msg:
            if msg.errno != errno.EAGAIN:
                tarsLogger.info('tcp recv, fd: %d, %s, faild!, %s, close',
                                self.getFd(), self.getEndPointInfo(), msg)
                self.close()
                return None

        tarsLogger.info('tcp recv, fd: %d, %s, nbytes: %d',
                        self.getFd(), self.getEndPointInfo(), len(buf))
        return buf
@brief: 实现tcp的recv
@param bufsize: 接收大小
@type bufsize: int
@param flag: 接收标志
@param flag: int
@return: 接收的内容，接收出错返回None
@rtype: str
biliup/Danmaku/tars/__trans.py