[Mono-list] Code Change Needed for MySql Connector/Net

Kenneth H. Brannigan kbrannigan at vitruviansolutions.com
Fri Nov 30 01:19:26 EST 2007


I just wanted to let everyone know if you use the MySql Connector/NET  
and you are unable to connect you might need to make the foloowing  
coding change to the MySql.Data.dll code:

	    Socket socket = unix ?
				new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.IP) :
				new Socket(AddressFamily.InterNetwork, SocketType.Stream,  
ProtocolType.Tcp);

             socket.Connect(endPoint);


             // Following code causes issue on MONO.
             //IAsyncResult ias = socket.BeginConnect(endPoint, null,  
null);
             //if (!ias.AsyncWaitHandle.WaitOne((int)timeOut * 1000,  
false))
             //{
             //    socket.Close();
             //    return null;
             //}
             //try
             //{
             //    socket.EndConnect(ias);
             //}
             //catch (Exception)
             //{
             //    socket.Close();
             //    return null;
             //}
			NetworkStream stream = new NetworkStream(socket, true);
			GC.SuppressFinalize(socket);
			GC.SuppressFinalize(stream);
			return stream;

Once I changed the code to no longer use the asynchronous method  
everything connected perfectly.

Thanks,
Ken


Kenneth H. Brannigan
CTO

Vitruvian Solutions®, LLC
Mobile: 201.602.6542
E-mail: kbrannigan at vitruviansolutions.com
Web: www.vitruviansolutions.com

The contents of this e-mail are privileged and confidential. This e- 
mail is intended to be read only by the individual(s) or entity to  
whom it is addressed. If you are not the intended recipient of this e- 
mail, please notify the sender and delete the e-mail. Any review,  
retransmission, dissemination, copying or other use of this e-mail or  
its contents is strictly prohibited.





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20071130/09b221d8/attachment.html 


More information about the Mono-list mailing list