def test(): HOST = '127.0.0.1' PORT = 40241 ffc = ffrpc_t(HOST, PORT, 15) req = ttypes.echo_thrift_in_t('ohNice') ret = ttypes.echo_thrift_out_t() ffc.call('scene@0', req, ret) print('error_info = %s' %(ffc.error_msg()), ret)
#debub print('11111111111111111111 222222222') if body_field_len > 0: body_field_data= body_recv[dest_service_name_len + 12 + dest_msg_name_len+28 + 4: dest_service_name_len + 12 + dest_msg_name_len + 28 + 4 + body_field_len] #debub print('dest_msg_name_str', dest_msg_name_str, 'body_field_len', body_field_len) decode_msg(ret_msg, body_field_data) #debub print('body_field_data len=%d' % len(body_field_data), ret_msg) self.err_info = body_recv[dest_service_name_len + 12 + dest_msg_name_len + 28 + 4 + body_field_len + 4:] except Exception as e: self.err_info = 'call failed:'+str(e) except: self.err_info = 'call failed unknown exception' tcpCliSock.close() tcpCliSock = None if len(self.err_info) > 0: return False return True if __name__ == '__main__': HOST = '127.0.0.1' PORT = 10246 ffc = ffrpc_t(HOST, PORT, 1.5) req = ttypes.echo_thrift_in_t('ohNice') ret = ttypes.echo_thrift_out_t() ffc.call('echo', req, ret, 'ff') print('error_info = %s' %(ffc.error_msg()), ret)