Example #1
0
    def __init__(
        self,
        host,
        port,
        handler=None,
        multicast=False,
        broadcast=False,
        ttl=8,
        loopback=False,
        reuse_address=True,
        read_timeout=0.5,
        buffer_size=1500,
    ):

        CommunicationHandler.__init__(self, host, port, handler)

        self.__enabled = True

        self.__ttl = ttl
        self.__loopback = 1 if loopback else 0
        self.__reuse_address = 1 if reuse_address else 0
        self.__timeout = read_timeout
        self.__buffer_size = buffer_size
        self.__send_lock = threading.RLock()

        self.__is_multicast = multicast
        self.__is_broadcast = broadcast

        self.__sessions = {}

        self.__incomplete_messages = {}
Example #2
0
 def __init__(self, host, port, handler, read_timeout=0.5, backlog=5):
     CommunicationHandler.__init__(self, host, port, handler)
     
     self.__enabled = True
     
     self.__timeout      = read_timeout
     self.__backlog      = backlog 
     self.__send_lock    = threading.RLock()
     self.__connections  = []
Example #3
0
 def stop(self):
     self.__enabled = False
     self.__udp_socket.close()
     CommunicationHandler.stop(self)
Example #4
0
 def start(self):
     CommunicationHandler.start(self)
     self.__create_socket()
     self.__receiver = self.__create_receiver()
     self.__receiver.start()
Example #5
0
 def start(self):
     CommunicationHandler.start(self)
     self.__create_socket()
     self.__create_socket_acceptor().start()