Esempio n. 1
0
    def __init__(self, ip, port, handler):
        ThreadingUDPServer.__init__(self, (ip, port), handler)
        Thread.__init__(self, target=self.serve_forever)

        # Set the thread name to the class name
        Thread.setName(self, f'UDP-{self.__class__.__name__} Server')
        self.daemon = True
Esempio n. 2
0
 def __init__(self, addr, handler, poll_interval=0.5, bind_and_activate=True, interfaces=None):
     ThreadingUDPServer.__init__(self, ('', addr[1]),
                                 handler,
                                 bind_and_activate)
     ControlMixin.__init__(self, handler, poll_interval)
     self._multicast_address = addr
     self._listen_interfaces = interfaces
     self.set_loopback_mode(1)  # localhost
     self.set_ttl(2)  # localhost and local network
     self.handle_membership(socket.IP_ADD_MEMBERSHIP)
Esempio n. 3
0
 def __init__(self, server_address, RequestHandlerClass, wrappers, sname,
              sid, ttl, timeout, logger):
     ThreadingUDPServer.__init__(self, server_address, RequestHandlerClass)
     self.wrappers = wrappers
     self.sname = sname
     self.sid = sid
     self.ttl = ttl
     self.timeout = timeout
     # Logger parameters
     self.logger = logger
     self._LOGGING_ = False if logger is None else True
Esempio n. 4
0
    def __init__(
        self,
        server_address: Tuple[str, int],
        accounts: Dict[str, SIAAccount],
        func: Callable[[SIAEvent], None],
        counts: Counter,
    ):
        """Create a SIA UDP Server.

        Arguments:
            server_address Tuple[string, int] -- the address the server should listen on.
            accounts Dict[str, SIAAccount] -- accounts as dict with account_id as key, SIAAccount object as value.
            func Callable[[SIAEvent], None] -- Function called for each valid SIA event, that can be matched to a account.
            counts Counter -- counter kept by client to give insights in how many errorous events were discarded of each type.

        """
        ThreadingUDPServer.__init__(self, server_address, SIAUDPHandler)
        BaseSIAServer.__init__(self, accounts, func, counts)
Esempio n. 5
0
File: log.py Progetto: awsch/lantz
 def __init__(self, addr, handler, timeout=1):
     ThreadingUDPServer.__init__(self, addr, LogRecordDatagramHandler)
     BaseServer.__init__(self, handler, timeout)
Esempio n. 6
0
	def __init__( self, port,name,liveaddr, handle=handle ):
		self.name=name
		self.liveaddr=liveaddr
		UDP.__init__( self, ('', port), handle )
Esempio n. 7
0
 def __init__(self, addr, handler, timeout=1):
     ThreadingUDPServer.__init__(self, addr, LogRecordDatagramHandler)
     BaseServer.__init__(self, handler, timeout)