PC Review


Reply
Thread Tools Rate Thread

checking for valid connection

 
 
Peter Row
Guest
Posts: n/a
 
      29th Jun 2005
Hi,

Today we had a thunder storm with lightening/torrental rain the works the
process of which seemed to screw up my 4-port network hub. At the time I was
testing my Windows app which uses a SQL Server database, I changed something
in the UI that required DB access and since by hub had gone it couldn't get
access.

The result was my application hung and I had to use task manager to end it.

So the question is what is the best way to program against this using
VB.NET/ADO.NET?
Have a separate thread that periodically prods the connection to make sure
it's okay, something else?

Regards,
Peter


 
Reply With Quote
 
 
 
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      29th Jun 2005
I'm working on my "Getting Connected" chapter in my new book and this
subject came up.
When ADO (wow, I just looked down at your email address... kinda crude isn't
it... well, anyway...) or ADO.NET is using a connection (has it open), it's
kept in the connection pool until you need to perform some operation. Think
of the pooling mechanism as an old switchboard--when your connection is
open, you're "plugged" into a server connection. If the server goes away
(and this did not happen in your case), the network can still be up and the
network interface card can still see the intranet. In this case, it does not
take long for the pooler to notice that the connection is dead. However, if
the NIC is down or the network itself is down (as in your case), the NIC
timeout kicks in. Some cards take longer than others, but it's usually about
a minute before they report problems. This gives systems managers (and
switches) time to route or re-route cables without disturbing the net. Ok,
so the first NIC times out and your application gets an exception. At this
point if you try to close the connection and reopen one, the pooler looks
for another pooled connection and the process is repeated. This can take
quite some time. In ADO.NET 2.0 you can flush the pool if necessary and
actually test the viability of the network. Of course you can do that now as
well, but it's more difficult.
So, bottom line: Exception handlers need to be written to deal with this
sort of (not THAT unusual) occurrence. Just keep in mind that the pooled
connections can get in the way. If you're using a Windows Forms application,
turn it off--it does not help that much anyway.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Peter Row" <****.off@bastard_spammers.com> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> Today we had a thunder storm with lightening/torrental rain the works the
> process of which seemed to screw up my 4-port network hub. At the time I
> was testing my Windows app which uses a SQL Server database, I changed
> something in the UI that required DB access and since by hub had gone it
> couldn't get access.
>
> The result was my application hung and I had to use task manager to end
> it.
>
> So the question is what is the best way to program against this using
> VB.NET/ADO.NET?
> Have a separate thread that periodically prods the connection to make sure
> it's okay, something else?
>
> Regards,
> Peter
>



 
Reply With Quote
 
Peter Row
Guest
Posts: n/a
 
      1st Jul 2005
Hi,

Thanks for the reply, I'm not sure but I think that a wire has been crossed
here.
The network I was using was working fine, my computers network card was
fine. However I use a network hub so that I can plug my laptop and desktop
into a single network socket.

The storm caused the hub to go screwy (I had to power it down and up again
to
reset it) my network card on my machine was working fine still and so was
the server that has SQL Server on, but since the hub went down the
connection between the two was removed.

I tried a few tests like ping'ing first before I end tasked my app I was
testing.
The point being that regardless of if you have exception handling or not
it shouldn't hang. It should either display a message indicating the network
connection has been cut or if it didn't have exception handling, (which it
does by the way) it should crash with a critical error; either way it
shouldn't
just hang.

There must be some way to monitor the connections.

Bye,
Peter
"William (Bill) Vaughn" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I'm working on my "Getting Connected" chapter in my new book and this
> subject came up.
> When ADO (wow, I just looked down at your email address... kinda crude
> isn't it... well, anyway...) or ADO.NET is using a connection (has it
> open), it's kept in the connection pool until you need to perform some
> operation. Think of the pooling mechanism as an old switchboard--when your
> connection is open, you're "plugged" into a server connection. If the
> server goes away (and this did not happen in your case), the network can
> still be up and the network interface card can still see the intranet. In
> this case, it does not take long for the pooler to notice that the
> connection is dead. However, if the NIC is down or the network itself is
> down (as in your case), the NIC timeout kicks in. Some cards take longer
> than others, but it's usually about a minute before they report problems.
> This gives systems managers (and switches) time to route or re-route
> cables without disturbing the net. Ok, so the first NIC times out and your
> application gets an exception. At this point if you try to close the
> connection and reopen one, the pooler looks for another pooled connection
> and the process is repeated. This can take quite some time. In ADO.NET 2.0
> you can flush the pool if necessary and actually test the viability of the
> network. Of course you can do that now as well, but it's more difficult.
> So, bottom line: Exception handlers need to be written to deal with this
> sort of (not THAT unusual) occurrence. Just keep in mind that the pooled
> connections can get in the way. If you're using a Windows Forms
> application, turn it off--it does not help that much anyway.
>
> hth
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
>
> "Peter Row" <****.off@bastard_spammers.com> wrote in message
> news:(E-Mail Removed)...
>> Hi,
>>
>> Today we had a thunder storm with lightening/torrental rain the works the
>> process of which seemed to screw up my 4-port network hub. At the time I
>> was testing my Windows app which uses a SQL Server database, I changed
>> something in the UI that required DB access and since by hub had gone it
>> couldn't get access.
>>
>> The result was my application hung and I had to use task manager to end
>> it.
>>
>> So the question is what is the best way to program against this using
>> VB.NET/ADO.NET?
>> Have a separate thread that periodically prods the connection to make
>> sure it's okay, something else?
>>
>> Regards,
>> Peter
>>

>
>



 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      1st Jul 2005
The 2.0 Framework has better network monitoring classes, but consider that
the hub is a link in the network. If it's down, there is no Ethernet signal
on the NIC.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Peter Row" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi,
>
> Thanks for the reply, I'm not sure but I think that a wire has been
> crossed here.
> The network I was using was working fine, my computers network card was
> fine. However I use a network hub so that I can plug my laptop and desktop
> into a single network socket.
>
> The storm caused the hub to go screwy (I had to power it down and up again
> to
> reset it) my network card on my machine was working fine still and so was
> the server that has SQL Server on, but since the hub went down the
> connection between the two was removed.
>
> I tried a few tests like ping'ing first before I end tasked my app I was
> testing.
> The point being that regardless of if you have exception handling or not
> it shouldn't hang. It should either display a message indicating the
> network
> connection has been cut or if it didn't have exception handling, (which it
> does by the way) it should crash with a critical error; either way it
> shouldn't
> just hang.
>
> There must be some way to monitor the connections.
>
> Bye,
> Peter
> "William (Bill) Vaughn" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> I'm working on my "Getting Connected" chapter in my new book and this
>> subject came up.
>> When ADO (wow, I just looked down at your email address... kinda crude
>> isn't it... well, anyway...) or ADO.NET is using a connection (has it
>> open), it's kept in the connection pool until you need to perform some
>> operation. Think of the pooling mechanism as an old switchboard--when
>> your connection is open, you're "plugged" into a server connection. If
>> the server goes away (and this did not happen in your case), the network
>> can still be up and the network interface card can still see the
>> intranet. In this case, it does not take long for the pooler to notice
>> that the connection is dead. However, if the NIC is down or the network
>> itself is down (as in your case), the NIC timeout kicks in. Some cards
>> take longer than others, but it's usually about a minute before they
>> report problems. This gives systems managers (and switches) time to route
>> or re-route cables without disturbing the net. Ok, so the first NIC times
>> out and your application gets an exception. At this point if you try to
>> close the connection and reopen one, the pooler looks for another pooled
>> connection and the process is repeated. This can take quite some time. In
>> ADO.NET 2.0 you can flush the pool if necessary and actually test the
>> viability of the network. Of course you can do that now as well, but it's
>> more difficult.
>> So, bottom line: Exception handlers need to be written to deal with this
>> sort of (not THAT unusual) occurrence. Just keep in mind that the pooled
>> connections can get in the way. If you're using a Windows Forms
>> application, turn it off--it does not help that much anyway.
>>
>> hth
>>
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> www.betav.com/blog/billva
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>>
>> "Peter Row" <****.off@bastard_spammers.com> wrote in message
>> news:(E-Mail Removed)...
>>> Hi,
>>>
>>> Today we had a thunder storm with lightening/torrental rain the works
>>> the process of which seemed to screw up my 4-port network hub. At the
>>> time I was testing my Windows app which uses a SQL Server database, I
>>> changed something in the UI that required DB access and since by hub had
>>> gone it couldn't get access.
>>>
>>> The result was my application hung and I had to use task manager to end
>>> it.
>>>
>>> So the question is what is the best way to program against this using
>>> VB.NET/ADO.NET?
>>> Have a separate thread that periodically prods the connection to make
>>> sure it's okay, something else?
>>>
>>> Regards,
>>> Peter
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking for valid datetime Mike P Microsoft C# .NET 5 3rd Jun 2008 02:57 PM
Checking for a valid date Armin Zingler Microsoft VB .NET 28 29th Jun 2005 01:15 AM
Checking for valid characters Brad Microsoft VB .NET 2 7th Nov 2004 07:17 PM
Checking all contacts are valid Andrew Chalk Microsoft Outlook Contacts 0 28th Sep 2004 04:09 PM
Checking for Valid Datatype Anonymous Microsoft Dot NET Framework 3 7th Jan 2004 01:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:56 AM.