/// <summary> /// May I have a new client front end with this name? /// </summary> /// <param name="name">The name of the client</param> public ClientFrontEnd(string name) { Contract.Requires(name != null && name != "server"); this.name = name; // Specifies that this is a client this.udpMulticast = new UdpMulticast(1); }
/// <summary> /// 开启组播 /// </summary> /// <param name="info"></param> public static void StartUdpBeeper(MulticastInfo info) { if (UdpBeeper == null) { UdpMulticast.Settings setting = new UdpMulticast.Settings(); setting.TargetIP = "230.0.0.0"; setting.TargetPort = 4321; setting.LocalIP = Network.GetActiveIPv4().IpAddress; setting.LocalPort = 2094; setting.Period = 7000; UdpBeeper = new UdpMulticast(setting); UdpBeeper.Start(info); } }
/// <summary> /// May I have a new server front end? /// </summary> public ServerFrontEnd() { // Create a new udpMulticast as a server this.udpMulticast = new UdpMulticast(0); this.prevPackets = new Dictionary <string, Packet>(); }