[Mono-list] SocketException: Connection refused not caught by try/catch
Mario Alberto Chavez
chavezmarioalberto@msn.com
Wed, 15 Oct 2003 18:06:36 -0700
Daniel;
My server doesnt' use trusted connection, anyway my problem is that
SocketException is not being caught by the try/catch block, it breaks my
program. I intentionally specified an ip address that doesn't have a sql
server running.
Mario Chavez
>From: "Daniel Morgan" <danielmorgan@verizon.net>
>To: "Mario Alberto Chavez" <chavezmarioalberto@msn.com>
>Subject: RE: [Mono-list] SocketException: Connection refused not caught by
>try/catch
>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
>Chavez
>Sent: Wednesday, October 15, 2003 7:33 PM
>To: mono-list@ximian.com
>Subject: [Mono-list] SocketException: Connection refused not caught by
>try/catch
>
>
>
>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=10.128.9.10;" +
> "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
>
>Regards,
>
>Mario A Chavez Cardenas
>
>_________________________________________________________________
>Charla con tus amigos en línea mediante MSN Messenger:
>http://messenger.yupimsn.com/
>
>_______________________________________________
>Mono-list maillist - Mono-list@lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list
>
_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger:
http://messenger.yupimsn.com/