diff --git a/CSRedis/CSRedis.csproj b/CSRedis/CSRedis.csproj index b6a680c..e68f9d3 100644 --- a/CSRedis/CSRedis.csproj +++ b/CSRedis/CSRedis.csproj @@ -12,6 +12,8 @@ v4.0 512 + 8.0.30703 + 2.0 AnyCPU diff --git a/CSRedis/Internal/IO/RedisSocket.cs b/CSRedis/Internal/IO/RedisSocket.cs index 4017bef..a075775 100644 --- a/CSRedis/Internal/IO/RedisSocket.cs +++ b/CSRedis/Internal/IO/RedisSocket.cs @@ -37,7 +37,14 @@ public RedisSocket(bool ssl) public void Connect(EndPoint endpoint) { InitSocket(endpoint); - _socket.Connect(endpoint); + if (endpoint is DnsEndPoint) + { + var host = (endpoint as DnsEndPoint).Host; + var port = (endpoint as DnsEndPoint).Port; + _socket.Connect(host,port); + } + else if (endpoint is IPEndPoint) + _socket.Connect((endpoint as IPEndPoint)); } public bool ConnectAsync(SocketAsyncEventArgs args) @@ -72,7 +79,7 @@ void InitSocket(EndPoint endpoint) if (_socket != null) _socket.Dispose(); - _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + _socket = new Socket(endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); _remote = endpoint; } diff --git a/CSRedis/RedisClient.cs b/CSRedis/RedisClient.cs index 8aefebb..851981d 100644 --- a/CSRedis/RedisClient.cs +++ b/CSRedis/RedisClient.cs @@ -176,7 +176,7 @@ public RedisClient(string host, int port, int asyncConcurrency, int asyncBufferS /// Max concurrent threads (default 1000) /// Async thread buffer size (default 10240 bytes) public RedisClient(string host, int port, bool ssl, int asyncConcurrency, int asyncBufferSize) - : this(new DnsEndPoint(host, port), ssl, asyncConcurrency, asyncBufferSize) + : this(new DnsEndPoint(host, port, System.Net.Sockets.AddressFamily.InterNetwork), ssl, asyncConcurrency, asyncBufferSize) { } ///