Пример #1
0
class ProcessCliente (Thread):

    def __init__(self, connectClient):
        Thread.__init__(self)
        self.client = connectClient
        self.sqlite = ReadJSON()

    def run(self):
        self.sqlite = ReadJSON()
        string = ""
        while True:
            try:
                while True:
                    data =  self.client.recv(1024)
                    if not data: break
                    string += data.decode()
                    boolean = re.search("HandleServicesSockets", string)
                    if boolean:
                        self.sqlite.indetifyAndInsertDataJSON(string.replace("\nHandleServicesSockets\n",""))
                        break
                print(string)
                string = ""
                time.sleep(5)
            except ConnectionResetError as e:
                print("Se cerro la conexion", self.client)
                break
            except Exception as e:
                print(e)
                break

    def startRun(self):
        try:
            self.start()
        except Exception as e:
            print (e)
Пример #2
0
 def __init__(self, connectClient):
     Thread.__init__(self)
     self.client = connectClient
     self.sqlite = ReadJSON()