From: Date: October 30 2006 5:22pm Subject: Connector/NET commit: r438 - in branches/1.0: . mysqlclient/common List-Archive: http://lists.mysql.com/commits/14571 X-Bug: 23758 Message-Id: <200610301622.k9UGMUBF018580@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/1.0/CHANGES branches/1.0/mysqlclient/common/StreamCreator.cs Log: Bug #23758 Unable to connect to any server - IPv6 related Modified: branches/1.0/CHANGES =================================================================== --- branches/1.0/CHANGES 2006-10-27 20:31:18 UTC (rev 437) +++ branches/1.0/CHANGES 2006-10-30 16:22:30 UTC (rev 438) @@ -11,6 +11,7 @@ ----------------------- Bug #23268 System.FormatException when invoking procedure with ENUM input parameter Bug #23538 Exception thrown when GetSchemaTable is called and "fields" is null. + Bug #23758 Unable to connect to any server - IPv6 related Version 1.0.8 RC Modified: branches/1.0/mysqlclient/common/StreamCreator.cs =================================================================== --- branches/1.0/mysqlclient/common/StreamCreator.cs 2006-10-27 20:31:18 UTC (rev 437) +++ branches/1.0/mysqlclient/common/StreamCreator.cs 2006-10-30 16:22:30 UTC (rev 438) @@ -34,10 +34,10 @@ /// internal class StreamCreator { - string hostList; - int port; - string pipeName; - int timeOut; + string hostList; + int port; + string pipeName; + int timeOut; public StreamCreator(string hosts, int port, string pipeName) { @@ -72,11 +72,15 @@ #if NET20 IPHostEntry ipHE = Dns.GetHostEntry(dnsHosts[index]); #else - IPHostEntry ipHE = Dns.GetHostByName(dnsHosts[index]); + IPHostEntry ipHE = Dns.GetHostByName(dnsHosts[index]); #endif foreach (IPAddress address in ipHE.AddressList) { + // MySQL doesn't currently support IPv6 addresses + if (address.AddressFamily == AddressFamily.InterNetworkV6) + continue; + stream = CreateSocketStream(address, port, false); if (stream != null) break; @@ -93,7 +97,7 @@ return stream; } - private Stream CreateNamedPipeStream( string hostname ) + private Stream CreateNamedPipeStream(string hostname) { string pipePath; if (0 == String.Compare(hostname, "localhost", true)) @@ -113,22 +117,22 @@ #endif // then we need to construct a UnixEndPoint object - EndPoint ep = (EndPoint)a.CreateInstance("Mono.Posix.UnixEndPoint", - false, BindingFlags.CreateInstance, null, + EndPoint ep = (EndPoint)a.CreateInstance("Mono.Posix.UnixEndPoint", + false, BindingFlags.CreateInstance, null, new object[1] { host }, null, null); return ep; } - private Stream CreateSocketStream(IPAddress ip, int port, bool unix) + private Stream CreateSocketStream(IPAddress ip, int port, bool unix) { EndPoint endPoint; if (!Platform.IsWindows() && unix) endPoint = CreateUnixEndPoint(hostList); else - endPoint = new IPEndPoint(ip, port); + endPoint = new IPEndPoint(ip, port); - Socket socket = unix ? + Socket socket = unix ? new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.IP) : new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IAsyncResult ias = socket.BeginConnect(endPoint, null, null);