Central point to check for LAN disconnection in .NET

  • Thread starter Thread starter Roger Tranchez
  • Start date Start date
R

Roger Tranchez

Hello,

We have an application that use data from our sql server.

We access this information trough TableAdapters, direct queries and
datacontextS (LINQ).

All these methods use the same CONNECTION STRING located on the application
settings.

We don't explicitly open or close connections on these objects as we let the
connection pool do the work.

The problem is that we have a lot of portable computers and external
workers, and they lost connection when they unplug their computers or the
remote connection fails.

Is there any way to control FROM A CENTRAL POINT (event) when the connection
is lost?

I was thinking if the connection pool have such an event, or similar.

I don't want to use a timer that "pings" the server: this seems to me kind
of ugly.

Thanks,
 
Hello Roger,

If I understand your request correctly, you meant to get notified of the
network connection change event without manually polling the network status.

" NetworkChange.NetworkAvailabilityChanged" should be a useful event for
this scenario. It¡¯s triggered when the availability of the network changes.
The network is available when at least one network interface is marked "up"
and is not a tunnel or loopback interface.

NetworkChange.NetworkAvailabilityChanged Event
http://msdn.microsoft.com/en-us/lib...networkchange.networkavailabilitychanged.aspx

#NetworkChange Class
http://msdn.microsoft.com/en-us/system.net.networkinformation.networkchange.aspx

#NetworkAvailabilityChangedEventHandler Delegate
http://msdn.microsoft.com/en-us/sys...n.networkavailabilitychangedeventhandler.aspx

#System.Net.NetworkInformation Namespace
http://msdn.microsoft.com/en-us/system.net.networkinformation.aspx

Please let me know if you have any other concerns, or need anything else.

Regards,
Jialiang Ge ([email protected], remove ¡®online.¡¯)
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hello Roger,

I am writing to check the status of the issue on your side. Would you mind
letting me know the result of the suggestions? If you need further
assistance, feel free to let me know. I will be more than happy to be of
assistance.

Have a great day!

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
 
Back
Top