public async Task <bool> IsRemoteReachable(string url)
        {
            try
            {
                URL           myUrl      = new URL(url);
                URLConnection connection = myUrl.OpenConnection();
                connection.ConnectTimeout = 3000;
                await connection.ConnectAsync();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #2
0
 /// <summary>
 /// Respondes the servicio.
 /// </summary>
 /// <returns><c>true</c>, if servicio was responded, <c>false</c> otherwise.</returns>
 /// <param name="Uri">URI.</param>
 public bool RespondeServicio(string Uri)
 {
     try
     {
         URL           myUrl      = new URL(Uri);
         URLConnection connection = myUrl.OpenConnection();
         connection.ConnectTimeout = 3000;
         var resultado = connection.ConnectAsync();
         resultado.Wait();
         return(true);
     }
     catch (Exception ex)
     {
         Log.RecordLog(ex, TypeLog.Error, Pilicy.Client);
         return(false);
     }
 }