Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WebSocketServer"/> class that listens for
        /// incoming connection attempts on the specified WebSocket URL.
        /// </summary>
        /// <param name="url">
        /// A <see cref="string"/> that contains a WebSocket URL.
        /// </param>
        public WebSocketServer(string url)
            : base(url)
        {
            if (BaseUri.AbsolutePath != "/")
            {
                throw new ArgumentException("Must not contain the path component: " + url, "url");
            }

            _serviceHosts = new ServiceHostManager(Log);
        }
Ejemplo n.º 2
0
        private void init()
        {
            _listener  = new HttpListener();
            _listening = false;
            _rootPath  = getRootPath();
            _svcHosts  = new ServiceHostManager();

            _windows = false;
            var os = Environment.OSVersion;

            if (os.Platform != PlatformID.Unix && os.Platform != PlatformID.MacOSX)
            {
                _windows = true;
            }

            var prefix = String.Format(
                "http{0}://*:{1}/", _port == 443 ? "s" : String.Empty, _port);

            _listener.Prefixes.Add(prefix);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebSocketServer"/> class that listens for
 /// incoming connection attempts on the specified <paramref name="address"/>, <paramref name="port"/>
 /// and <paramref name="secure"/>.
 /// </summary>
 /// <param name="address">
 /// A <see cref="System.Net.IPAddress"/> that contains a local IP address.
 /// </param>
 /// <param name="port">
 /// An <see cref="int"/> that contains a port number.
 /// </param>
 /// <param name="secure">
 /// A <see cref="bool"/> that indicates providing a secure connection or not.
 /// (<c>true</c> indicates providing a secure connection.)
 /// </param>
 public WebSocketServer(System.Net.IPAddress address, int port, bool secure)
     : base(address, port, "/", secure)
 {
     _serviceHosts = new ServiceHostManager(Log);
 }
Ejemplo n.º 4
0
 private void init()
 {
     _svcHosts = new ServiceHostManager();
 }