Package brisa :: Package core :: Module network_listeners :: Class UDPListener
[hide private]
[frames] | no frames]

Class UDPListener

source code

     object --+    
              |    
NetworkListener --+
                  |
                 UDPListener

Listens UDP in a given address and port (and in the given interface, if provided).

Instance Methods [hide private]
 
__init__(self, addr, port, interface='', observers=[], data_callback=None, shared_socket=None)
Constructor for the UDPListener class.
source code
 
start(self) source code
 
stop(self) source code
 
destroy(self)
Closes the socket, renders the object unusable.
source code
 
_create_socket(self, shared)
Creates the socket if a shared socket has not been passed to the constructor.
source code
 
_receive_datagram(self, sock, cond)
Implements the UDPListener listening actions.
source code

Inherited from NetworkListener: forward_data, is_listening, is_running, subscribe

Inherited from NetworkListener (private): _cleanup

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  BUFFER_SIZE = 1500
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, addr, port, interface='', observers=[], data_callback=None, shared_socket=None)
(Constructor)

source code 

Constructor for the UDPListener class.

Parameters:
  • addr (string) - address to listen on
  • port (integer) - port to listen on
  • interface (string) - interface to listen on
  • observers (list of INetworkObserver) - list of initial subscribers
  • data_callback (callable) - callback to get data forwarded to
  • shared_socket (socket.socket) - socket to be reused by this network listener
Overrides: object.__init__

start(self)

source code 
Overrides: NetworkListener.start

stop(self)

source code 
Overrides: NetworkListener.stop

destroy(self)

source code 

Closes the socket, renders the object unusable.

Overrides: NetworkListener.destroy

_create_socket(self, shared)

source code 

Creates the socket if a shared socket has not been passed to the constructor.

Parameters:
  • shared (socket.socket) - socket to be reused