Ejemplo n.º 1
0
 def init_client(self):
     self.commands = ["PI","VD"]
     self.connected = False
     self.AVsent = False
     self.send_buffer = ""
     self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     GlassProtocol.initialize(self)
Ejemplo n.º 2
0
 def run(self):
     self.init_client()
     count = 10
     while self.go:
         #Check to see if connected, if not try to connect to Glass Server
         if not self.connected:
             self.try_connect()
         else:
             if not self.AVsent: #If no AV sent then send add variables
                 self.AVsend(variables.list())
                                 
             #Check send buffer
             #self.send_data()
             #self.parse_data(self)
             GlassProtocol.sendrecv(self, self.sock)
         
             if self.go:
                 GlassProtocol.parse_data(self)
             #Check for server ping
             if (time.time() - self.lastRXtime) > 10:
                 self.reset_connect()
         
         #Time delay for know for testing
         #print count
         #count = count -1
         #time.sleep(0.01)
      
     logging.info("Client Thread Ended %s", self.client_thread.name)