Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Are you connecting via tcp? if so you could try using a straight socket connection with an async receive : here's some code :</p> <pre><code>class Program { static bool disc = false; static void Main(string[] args) { dbtest dt = new dbtest(); dt.Disconnected += new EventHandler(dt_Disconnected); dt.Start("10.1.32.97", 1433); while (!Console.KeyAvailable) { Console.WriteLine(disc?"disconnected":"tick"); Thread.Sleep(2000); } dt.Stop(); } static void dt_Disconnected(object sender, EventArgs e) { disc = true; Console.WriteLine("Disconnected"); } } public class dbtest { byte[] buffer = new byte[10]; Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); public event EventHandler Disconnected = null; public void Start(string host, int port) { if(s!=null) { Stop(); } s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); s.Connect(host, port); Console.WriteLine("Connected."); s.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, ReceiveCallBack, s); } public void Stop() { if (s != null) { s.Close(); s.Dispose(); s = null; } } void ReceiveCallBack(IAsyncResult ar) { Socket s = ar as Socket; if (s != null &amp;&amp; s.Connected) { int rcvd = s.EndReceive(ar); if (rcvd &gt; 0) { s.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, ReceiveCallBack, s); return; } } if(Disconnected!=null) Disconnected(this, EventArgs.Empty); } } </code></pre> <p>This is just basic - I'm not sure how long sql server will keep hold of a socket that hasn;t responded. Maybe add a count - reconnect on disconnect to see if its actually a real disconnect etc etc ...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload