Broadcast server worker thread.
140 def _listen(self):
141 r"""!Broadcast server worker thread
142
143 This function listen for magic packets on broadcast
144 address and send the connection info to the clients.
145
146 - listen for the magic packet <BW-Request>
147 - send connection info in an <BW-Result> macig packet"""
148 logging.debug("start listening for magic")
149 while not self._serverShutdown:
150 try:
151 payload, address = self._socket.recvfrom(1024)
152 payload = str(payload, "UTF-8")
153 if payload == "<BW3-Request>":
154 logging.debug("received magic <BW3-Request> from: %s", address[0])
155 logging.info("send connection info in magic <BW3-Result> to: %s", address[0])
156 self._socket.sendto("<BW3-Result>;".encode() + str(self._servePort).encode(), address)
157 except socket.timeout:
158 continue
159 self._serverThread = None
160 logging.debug("udp broadcast server stopped")
161