[Mono-winforms-list] RE: [Mono-list] SocketException: Connection refused not caught by try/catch

Mario Alberto Chavez chavezmarioalberto@msn.com
Wed, 15 Oct 2003 18:04:13 -0700


No the server doesn't use trusted connection, nut anyway my problem is not 
that I'm getting this exception (actually I used an IP address that doesn't 
exist). my problem is that the exception (SocketException) is not being 
caught by try/catch, it breaks my program.

Mario A Chavez Cardenas

>From: "Daniel Morgan" <danielmorgan@verizon.net>
>To: "Mario Alberto Chavez" <chavezmarioalberto@msn.com>
>Subject: RE: [Mono-list] SocketException: Connection refused not caught by 
>Date: Wed, 15 Oct 2003 20:53:46 -0400
>Just curious, is your SQL Server setup for authentication by SQL Server?
>If it is Windows only, then yes, you would get the connection refused?
>-----Original Message-----
>From: mono-list-admin@lists.ximian.com
>[mailto:mono-list-admin@lists.ximian.com]On Behalf Of Mario Alberto
>Sent: Wednesday, October 15, 2003 7:33 PM
>To: mono-list@ximian.com
>Subject: [Mono-list] SocketException: Connection refused not caught by
>I've updated mcs and mono from last night (Otc-14) cvs, and now
>System.Net.Sockets.SocketException is not being caught by try/catch. Please
>see test case:
>using System;
>using System.Data;
>using System.Data.SqlClient;
>public class Test
>     public static void Main(string[] args)
>     {
>	// Use a dummy server IP address
>        string connectionString =
>           "Server=;" +
>           "Database=pubs;" +
>           "User ID=myuserid;" +
>           "Password=mypassword;";
>	try{
>		IDbConnection dbcon;
>        		dbcon = new SqlConnection(connectionString);
>		Console.WriteLine("Openning connection...");
>		dbcon.Open();
>		dbcon.Close();
>	        dbcon = null;
>		Console.WriteLine("Closing connection...");
>	}catch(Exception e){
>		Console.WriteLine("Opps, no server");
>	}
>     }
>mcs connection.cs -r System.Data.dll
>mono connection.exe
>Openning connection...
>Unhandled Exception: System.Net.Sockets.SocketException: Connection refused
>Mario A Chavez Cardenas
>Charla con tus amigos en línea mediante MSN Messenger:
>Mono-list maillist  -  Mono-list@lists.ximian.com

Consigue aquí las mejores y mas recientes ofertas de trabajo en América 
Latina y USA: www.yupimsn.com/empleos