Beispiel #1
0
        /// <summary>
        /// Full constructor.
        /// </summary>
        /// <exception cref="ArgumentNullException">The <paramref name="socketFactory"/> argument is null.</exception>
        /// <exception cref="ArgumentOutOfRangeException">The <paramref name="multicastTimeToLive"/> argument is less than or equal to zero.</exception>
        public SsdpCommunicationsServer(ISocketFactory socketFactory, int localPort, int multicastTimeToLive, INetworkManager networkManager, ILogger logger, bool enableMultiSocketBinding)
        {
            if (socketFactory == null)
            {
                throw new ArgumentNullException(nameof(socketFactory));
            }

            if (multicastTimeToLive <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(multicastTimeToLive), "multicastTimeToLive must be greater than zero.");
            }

            _BroadcastListenSocketSynchroniser = new object();
            _SendSocketSynchroniser            = new object();

            _LocalPort     = localPort;
            _SocketFactory = socketFactory;

            _RequestParser  = new HttpRequestParser();
            _ResponseParser = new HttpResponseParser();

            _MulticastTtl             = multicastTimeToLive;
            _networkManager           = networkManager;
            _logger                   = logger;
            _enableMultiSocketBinding = enableMultiSocketBinding;
        }
Beispiel #2
0
        /// <summary>
        /// Full constructor.
        /// </summary>
        /// <param name="socketFactory">An implementation of the <see cref="ISocketFactory"/> interface that can be used to make new unicast and multicast sockets. Cannot be null.</param>
        /// <param name="localPort">The specific local port to use for all sockets created by this instance. Specify zero to indicate the system should choose a free port itself.</param>
        /// <param name="multicastTimeToLive">The multicast time to live value for multicast sockets. Technically this is a number of router hops, not a 'Time'. Must be greater than zero.</param>
        /// <exception cref="System.ArgumentNullException">The <paramref name="socketFactory"/> argument is null.</exception>
        /// <exception cref="System.ArgumentOutOfRangeException">The <paramref name="multicastTimeToLive"/> argument is less than or equal to zero.</exception>
        public SsdpCommunicationsServer(ISocketFactory socketFactory, int localPort, int multicastTimeToLive)
        {
            if (socketFactory == null)
            {
                throw new ArgumentNullException("socketFactory");
            }
            if (multicastTimeToLive <= 0)
            {
                throw new ArgumentOutOfRangeException("multicastTimeToLive", "multicastTimeToLive must be greater than zero.");
            }

            _BroadcastListenSocketSynchroniser = new object();
            _SendSocketSynchroniser            = new object();

            _LocalPort     = localPort;
            _SocketFactory = socketFactory;

            _RequestParser  = new HttpRequestParser();
            _ResponseParser = new HttpResponseParser();

            _MulticastTtl = multicastTimeToLive;
        }