R
Raj
This is a console application consuming a web service (Add). It works fine as
long as internet connectivity is there. In case of drop in internet
connectivity, i want to reattempt to consume the web service. As long as I
wish to continue, or once the web service is consumed the loop will
terminate. When I have problem with Internet Connectivity, the loop is not
iterating and Console.Read is skipped.
Any help would be appreciated
This is the output I got If I don't have internet connectivity:
The remote name could not be resolved: 'www.xxx.com'
Do you want to retry[Y/N]?
Y
Y
Out of try...catch, inside while
The remote name could not be resolved: 'www.digitechpower.com'
Do you want to retry[Y/N]?
Out of try...catch, inside while
Code Snippet:
static void Main(string[] args)
{
Service1 s = new Service1();
char cont='Y';
while(cont=='Y')
{
try
{
int result = s.Add(100, 200);
Console.WriteLine(result.ToString());
cont = 'N';
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine("Do you want to retry[Y/N]?");
cont = (Char)Console.Read();
Console.WriteLine(cont);
}
Console.WriteLine("Out of try...catch, inside while");
Console.Read();
}
Console.WriteLine("Reached End");
Console.Read();
}
Thank you
Regards
Raj
long as internet connectivity is there. In case of drop in internet
connectivity, i want to reattempt to consume the web service. As long as I
wish to continue, or once the web service is consumed the loop will
terminate. When I have problem with Internet Connectivity, the loop is not
iterating and Console.Read is skipped.
Any help would be appreciated
This is the output I got If I don't have internet connectivity:
The remote name could not be resolved: 'www.xxx.com'
Do you want to retry[Y/N]?
Y
Y
Out of try...catch, inside while
The remote name could not be resolved: 'www.digitechpower.com'
Do you want to retry[Y/N]?
Out of try...catch, inside while
Code Snippet:
static void Main(string[] args)
{
Service1 s = new Service1();
char cont='Y';
while(cont=='Y')
{
try
{
int result = s.Add(100, 200);
Console.WriteLine(result.ToString());
cont = 'N';
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine("Do you want to retry[Y/N]?");
cont = (Char)Console.Read();
Console.WriteLine(cont);
}
Console.WriteLine("Out of try...catch, inside while");
Console.Read();
}
Console.WriteLine("Reached End");
Console.Read();
}
Thank you
Regards
Raj