Example #1
0
def test_cbm():
  try:  
    service_client = RpcClient(CbmService, port=PORT2)
    service_client.start()

    goto_quit = False
    while True:
      cmd = raw_input('请输入命令:')
      if cmd == 'q' or cmd == 'Q':
        goto_quit = True
        break
      elif cmd == 'c' or cmd == 'C':
        break
      if cmd in all_cmds:
        all_cmds[cmd](service_client.get())
        print '\n'
      else:
        print '命令%s未实现!!!' % cmd
    service_client.close()

    if goto_quit:
      # 关闭rpc服务器
      QuitServer()

  except Thrift.TException, tx:
    print '%s' % (tx.message)
Example #2
0
def test_cbm():
    try:
        service_client = RpcClient(CbmService, port=PORT2)
        service_client.start()

        goto_quit = False
        while True:
            cmd = raw_input('请输入命令:')
            if cmd == 'q' or cmd == 'Q':
                goto_quit = True
                break
            elif cmd == 'c' or cmd == 'C':
                break
            if cmd in all_cmds:
                all_cmds[cmd](service_client.get())
                print '\n'
            else:
                print '命令%s未实现!!!' % cmd
        service_client.close()

        if goto_quit:
            # 关闭rpc服务器
            QuitServer()

    except Thrift.TException, tx:
        print '%s' % (tx.message)