Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SsdpListener" /> class.
        /// </summary>
        /// <param name="sockets">The ssdp sockets.</param>
        public SsdpListener(ISsdpSocket[] sockets)
        {
            if (sockets.Length == 0)
            {
                sockets = SsdpSocketFactory.BuildSockets().ToArray();
            }

            this.Sockets = new SsdpSocketCollection(sockets);

            this.Sockets.ForEachSocket(socket => socket.SsdpMessageReceived += this.OnSsdpMessageReceived);
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SsdpSearch"/> class.
        /// </summary>
        public SsdpSearch(params ISsdpSocket[] sockets)
        {
            if (sockets.Length == 0)
            {
                sockets = SsdpSocketFactory.BuildSockets().ToArray();
            }

            this.Sockets      = new SsdpSocketCollection(sockets);
            this.HostEndpoint = new IPEndPoint(Protocol.DiscoveryEndpoints.IPv4, Protocol.DefaultPort);
            this.SearchType   = Protocol.SsdpAll;
            this.Mx           = Protocol.DefaultMx;
        }