HSL 2.0 Framework
Description of the framework
Public Member Functions |List of all members
hsl20_4_udp.hsl20_4_udp.Multicast Class Reference

All methods for communication via UDP multicast More..

.

Inherits hsl20_4_udp.hsl20_4_udp.UdpBase

Public Member Functions

defset_address (self, server_ip, multicast_ip, port)
Sets the server address and multicast address where data can be received and sent. More...
defsend (self, data)
Sends data to the multicast group. More...
defstart_server (self)
Starts the UDP receive server. More...
-Public Member Functions inherited from hsl20_4_udp.hsl20_4_udp.UdpBase
def__init__ (self, framework, context_map)
Constructor. More...
defset_on_data (self, callback)
Sets a callback for data reception. More...
defset_on_error (self, callback)
Sets a callback in case of an error. More...
defstart_server (self)
Starts the UDP receive server. More...

Detailed Description

All methods for communication via UDP multicast

Deprecated:
This class should no longer be used

Provides communication via UDP/IP in both directions.

Is derived from UdpBase.

Example

class UDP_Client(hsl20_4.BaseModule):
def __init__(self, homeserver_context):
...
def on_init(self):
self.client=None
def on_input_value(self, index, value):
if index == self.PIN_I_DATA:
if self.client == None:
self.client = self.FRAMEWORK.create_udp_multicast()
self.client.set_address("" , self._get_input_value(self.PIN_I_IP), 4711)
self.client.send(value)

Example 2 contains a Multicast UDP client. If a telegram arrives at input 1 (PIN_I_DATA), it is sent to the multicast group via UDP.

Note
The class works asynchronously. None of the methods offered are blocked

Member Function Documentation

◆ send()

def hsl20_4_udp.hsl20_4_udp.multicast.send ( self,
data
)

Sends data to the multicast group

Parameters
datastring
Data
Exceptions
AttributeError
Is triggered if no multicast address or port has been defined yet

◆ set_address()

def hsl20_4_udp.hsl20_4_udp.multicast.set_address ( self,
server_ip,
multicast_ip,
port
)

Sets the server address and multicast address where data can be received and sent

Parameters
server_ipstring
IP address. If an empty string is specified, the data is received at the HomeServer network address
multicast_ipstring
Multicast address. Specifies the multicast group where the data can be received and sent
portint
IP port where the data can be received and sent
Exceptions
RuntimeError
If this method is called while the server is already started, a RuntimeError exception is thrown

◆ start_server()

def hsl20_4_udp.hsl20_4_udp.multicast.start_server ( self)

Starts the UDP receive server


The documentation for this class was generated from the following file: