def run(self):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
port = str(ui.local_port_stream)
print(ui.local_ip_stream, '-----ip--', ui.local_port_stream)
msg = 'this is kawaii-player At: port={} https={} msg={}'.format(
port, ui.https_media_server, ui.broadcast_message)
msg = bytes(msg , 'utf-8')
if ui.https_media_server:
https_val = 'https'
else:
https_val = 'http'
subnet_mask = ui.local_ip_stream.rsplit('.', 1)[0] + '.255'
notify_msg = '{0}://{1}:{2} started broadcasting. Now Clients can Discover it'.format(
https_val, ui.local_ip_stream, ui.local_port_stream)
send_notification(notify_msg)
print(subnet_mask)
while ui.broadcast_server:
s.sendto(msg, (subnet_mask,12345))
time.sleep(1)
send_notification('Broadcasting Stopped')
评论列表
文章目录