2025-04-06 12:42:10 +02:00

29 lines
923 B
Python

from ParticipantUDP import ParticipantUDP
from Messages.ParticipantMsg import ParticipantMsg
from Messages.NetworkIdMsg import NetworkIdMsg
from Things.TemperatureSensor import TemperatureSensor
from Thing import Thing
import socket
import threading
class SiteServer(ParticipantUDP):
"""! A site server is a participant which provides a shared simulated environment
"""
name = "Site Server"
def __init__(self, port=7681):
"""! Create a new site server
@param port The UDP port on which communication is received
"""
super().__init__(ip_address = "127.0.0.1", port = port)
self.isolated = False # site servers are never isolated
self.publishInterval = 0
def ProcessParticipantMsg(self, sender, msg):
print(f'{self.name} received Participant ')
self.Send(sender, NetworkIdMsg())
def ProcessNetworkId(self, msg):
pass