diff --git a/Example3/Program.cs b/Example3/Program.cs
index e2b534d7..7463a44d 100644
--- a/Example3/Program.cs
+++ b/Example3/Program.cs
@@ -18,7 +18,8 @@ namespace Example3
* with the 'secure' parameter set to true.
*/
var httpsv = new HttpServer (4649);
- //httpsv = new HttpServer (4649, true);
+ //var httpsv = new HttpServer (5963, true);
+ //var httpsv = new HttpServer (System.Net.IPAddress.Parse ("127.0.0.1"), 4649, false);
#if DEBUG
// To change the logging level.
httpsv.Log.Level = LogLevel.Trace;
diff --git a/websocket-sharp/Net/EndPointListener.cs b/websocket-sharp/Net/EndPointListener.cs
index b3339661..7bec84c6 100644
--- a/websocket-sharp/Net/EndPointListener.cs
+++ b/websocket-sharp/Net/EndPointListener.cs
@@ -311,6 +311,8 @@ namespace WebSocketSharp.Net
return null;
var host = uri.Host;
+ var dns = Uri.CheckHostName (host) == UriHostNameType.Dns;
+
var port = uri.Port;
var path = HttpUtility.UrlDecode (uri.AbsolutePath);
var pathSlash = path[path.Length - 1] == '/' ? path : path + "/";
@@ -323,7 +325,9 @@ namespace WebSocketSharp.Net
if (ppath.Length < bestLen)
continue;
- if (pref.Host != host || pref.Port != port)
+ var phost = pref.Host;
+ var pdns = Uri.CheckHostName (phost) == UriHostNameType.Dns;
+ if ((dns && pdns && phost != host) || pref.Port != port)
continue;
if (path.StartsWith (ppath) || pathSlash.StartsWith (ppath)) {
diff --git a/websocket-sharp/Server/HttpServer.cs b/websocket-sharp/Server/HttpServer.cs
index d98bc32d..5fc139fd 100644
--- a/websocket-sharp/Server/HttpServer.cs
+++ b/websocket-sharp/Server/HttpServer.cs
@@ -40,6 +40,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
+using System.Net.Sockets;
using System.Security.Cryptography.X509Certificates;
using System.Security.Principal;
using System.Threading;
@@ -135,6 +136,49 @@ namespace WebSocketSharp.Server
init ("*", port, secure);
}
+ ///
+ /// Initializes a new instance of the class with
+ /// the specified , ,
+ /// and .
+ ///
+ ///
+ /// An instance initialized by this constructor listens for the incoming
+ /// connection requests on .
+ ///
+ ///
+ /// A that represents the local IP address of the server.
+ ///
+ ///
+ /// An that represents the port number on which to listen.
+ ///
+ ///
+ /// A that indicates providing a secure connection or not.
+ /// (true indicates providing a secure connection.)
+ ///
+ ///
+ /// is .
+ ///
+ ///
+ /// isn't a local IP address.
+ ///
+ ///
+ /// isn't between 1 and 65535 inclusive.
+ ///
+ public HttpServer (System.Net.IPAddress address, int port, bool secure)
+ {
+ if (address == null)
+ throw new ArgumentNullException ("address");
+
+ if (!address.IsLocal ())
+ throw new ArgumentException ("Not a local IP address: " + address, "address");
+
+ if (!port.IsPortNumber ())
+ throw new ArgumentOutOfRangeException (
+ "port", "Not between 1 and 65535 inclusive: " + port);
+
+ init (address.ToString (), port, secure);
+ }
+
#endregion
#region Public Properties