How to detect working internet connection in C#?

Posted by detariael on Stack Overflow See other posts from Stack Overflow or by detariael
Published on 2010-03-26T06:58:03Z Indexed on 2010/03/26 7:03 UTC
Read the original article Hit count: 209

I have a C# code that basically uploads a file via FTP protocol (using FtpWebRequest). I'd like, however, to first determine whether there is a working internet connection before trying to upload the file (since, if there isn't there is no point in trying, the software should just sleep for a time and check again).

Is there an easy way to do it or should I just try to upload the file and in case it failed just try again, assuming the network connection was down?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ftpwebrequest