Bug #12626 Can't connect to specified MySQL hosts
Submitted: 17 Aug 2005 16:51 Modified: 18 Aug 2005 20:28
Reporter: Chris White Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.4 OS:Windows (WinXP Pro)
Assigned to: Reggie Burnett CPU Architecture:Any

[17 Aug 2005 16:51] Chris White
Description:
I am using Visual Studio 2005b2 with .NET 2.0, I looked at your bug report posted previously regarding worker threads and decided to try and code a fix for this, removing the asynchronous socket code and using regular sockets. Before I chose to do this, when the code was executed/debugged within the VS IDE it would run perfectly, but when compiled with Mono 1.1.8 or Compiled and executed outside of the IDE, all I would get is the error msg. After changing the code, all I get now is the same error msg, but even within the debugger.

I also tried checking the source tree for 1.0.5 where you said you fixed this, any reason its not available on the source tree or am I not looking in the right area?

How to repeat:
I am using Visual Studio 2005b2 with .NET 2.0, I looked at your bug report posted previously regarding worker threads and decided to try and code a fix for this, removing the asynchronous socket code and using regular sockets. Before I chose to do this, when the code was executed/debugged within the VS IDE it would run perfectly, but when compiled with Mono 1.1.8 or Compiled and executed outside of the IDE, all I would get is the error msg. After changing the code, all I get now is the same error msg, but even within the debugger.

I replaced the code as follows:

private Stream CreateSocketStream( IPAddress ip, int port ) 
{
	Socket socket = new Socket(AddressFamily.InterNetwork, 
	      SocketType.Stream, ProtocolType.Tcp);

I replaced the code as follows:

	try
	{
		//
		// Lets try to connect
		IPEndPoint endPoint	= new IPEndPoint( ip, port);
                socket.Connect(endPoint);
                socket.Blocking = false;
		socket.SetSocketOption( SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1 );
                return new NetworkStream( socket, true );
	}
	catch (Exception)
	{
		return null;
	}
}
[18 Aug 2005 20:28] Reggie Burnett
Chris

I have totally rewritten the socket creation code due to another bug report that was submitted.  Basically the Socket/NetworkStream classes are insufficient for what I need so I would up writing a new SocketStream class that properly supports connection timeout without resorting to async classes.

This will be in 1.0.5