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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…