Esempio n. 1
0
 if len(sys.argv) != 4:
     host = raw_input('Enter game server host IP/name: ')
     port = int(raw_input('Enter host port: '))
     pw = raw_input('Enter password: '******'start client')
     try:
         while working and (hfclient.connected or not hfclient.authed):
             #print("\t%s" % (time.time() - hfclient.last_pong_time))
             if time.time() - hfclient.last_pong_time > 6 and hfclient.last_ping_time < hfclient.last_pong_time:
                 hfclient.ping()
             asyncore.loop(timeout=3, count=1)
     except EOFError, KeyboardInterrupt:
         hfclient.close()
     print('end client')
 
 thread.start_new_thread(run_hf_client, (hfclient,))
Esempio n. 2
0
#        port = int(sys.argv[2])
#        user = sys.argv[3]
#        pw = sys.argv[4]
   
    host = '127.0.0.1'
    port = 14507
    user = '******'
    pw = 'pass'
    
    
    def packetListener(packet):
        print(">>> received : %s" % packet)
    
    
    frontline_client = FrontlineClient(fakeConsole, host, port, user, pw, keepalive=True)
    frontline_client.add_listener(packetListener)
    working = True
    
    def run_hf_client(frontline_client):
        print('start client')
        try:
            while working and (frontline_client.connected or not frontline_client.authed):
                asyncore.loop(timeout=3, count=1)
        except EOFError, KeyboardInterrupt:
            frontline_client.close()
        print('end client')
    
    thread.start_new_thread(run_hf_client, (frontline_client,))
    
    time.sleep(3)