Exemplo n.º 1
0
 def read(self):
     rval, im = self._read()
     if not rval:
         self.release()
         print_green('Waiting for new connection')
         self.init(self.ip, self.port)
         rval, im = self._read()
     return im
Exemplo n.º 2
0
 def init(self, ip, port): 
     self.s_ = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     self.s_.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
     print_green('Hostname: {:} READY'.format(socket.gethostname()))
     
     self.s_.bind((self.ip_, self.port_))
     self.s_.listen(1)
     self.conn_, self.addr_ = self.s_.accept()
Exemplo n.º 3
0
    def run(self):
        rval = True

        while rval:
            start = time.time()
            rval, im = cap._read()
            end = time.time()

            if not rval:
                self.release()
                print_green('Waiting for new connection')
                self.init(self.ip_, self.port_)
                rval = True
                continue

            self.on_image(self, im)