Exemplo n.º 1
0
        static void Main(string[] args)
        {
            MulticastPolicyConfiguration config = new MulticastPolicyConfiguration();
            config.AnySourceConfiguration.Add("*", new MulticastResource(
              //  IPAddress.Parse("224.0.0.1"), 3000));
              IPAddress.Parse("239.0.0.5"), 45678));
            using (MulticastPolicyServer server = new MulticastPolicyServer(config))
            {
                server.Start();

                Console.Write("Hit enter to exit...");
                Console.ReadLine();

                server.Stop();
            }
        }
        public MulticastPolicyServerCore(AddressFamily addressFamily, MulticastPolicyConfiguration configuration)
        {
            Debug.Assert(configuration != null, "Configuration should not be null");

            this.addressFamily = addressFamily;
            this.configuration = configuration;

            if (addressFamily == AddressFamily.InterNetwork)
            {
                this.localEndPoint = new IPEndPoint(IPAddress.Any, MulticastPolicyPort);
                this.socketOptionLevel = SocketOptionLevel.IP;
            }
            else
            {
                this.localEndPoint = new IPEndPoint(IPAddress.IPv6Any, MulticastPolicyPort);
                this.socketOptionLevel = SocketOptionLevel.IPv6;
            }

            SetMulticastSocketFactory(new RealMulticastSocketFactory());
        }
 public MulticastPolicyServer(MulticastPolicyConfiguration configuration)
 {
     this.configuration = configuration.MakeReadOnlyCopy();
 }