Example #1
0
                asyncore.loop(timeout=3, count=1)
        except EOFError, KeyboardInterrupt:
            hfclient.close()
        print('end client')
    
    thread.start_new_thread(run_hf_client, (hfclient,))
    
    time.sleep(3)
    
    r = Rcon(fakeConsole, ("what", 1337), "ever")
    r.set_homefront_client(hfclient)
    
    def close_hf_connection():
        try:
            hfclient.close()
        except:
            pass
    t = threading.Timer(10.0, hfclient.close)
    t.start()
    
    print('-----------------------------> test command : say "B3 test"')
    r.write('say "B3 test"')  
    
    for i in range(30):
        hfclient.ping()
        time.sleep(.5)
    
    working = False
    
    print(".")
Example #2
0
    r.set_frontline_client(frontline_client)
    
    def close_hf_connection():
        try:
            frontline_client.close()
        except:
            pass
    t = threading.Timer(10.0, frontline_client.close)
    t.start()
    
    for cmd in ('PLAYERLIST',
                'KICK',
                'PLAYERSAY',
                'SAY hello everybody',
                'CHATLOGGING TRUE',
                'MAPLIST',
                'GetCurrentMap',
                'GetNextMap',
                ):
        print('-----------------------------> test command : %r' % cmd)
        r.write(cmd) 
        time.sleep(1)
    
    for i in range(30):
        frontline_client.ping()
        time.sleep(.5)
    
    working = False
    
    print(".")