How to detect network instability with C #

2

I have a WinForms system where the folders that this system generates and uses is on a server, but there are some routines of this system that are creating multiple PDF's on the server, and when there is any instability in the network it does not create some PDF's. I would like to know if there is any framework that detects instability or fall in the network and warns the user or manage it, someone has heard of something like that. If at the moment the system is using the server the network hangs or hangs anything the routine will warn or wait to generate when it returns to normal.

    
asked by anonymous 29.03.2017 / 14:54

1 answer

2

From the 2.0 framework you can do with GetIsNetworkAvailable() :

System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()

To monitor changes to IP or whether you are connected or not, use the NetworkChange class events:

System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged
System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged
    
31.03.2017 / 16:34