goo hey

goo hey

  • NA
  • 29
  • 5.2k

while loop causing a deadlock

Mar 10 2019 8:28 AM
im using a do , while (true loop) and with the setup my code is getting stuck reading the loop continously would a break option work befroe the code reads  ERROR: no entries found??                       
 
if (!reply.EndsWith("404 Not Found"))
                            {
                                string line1 = sr.ReadLine();
                                 //line1 = sr.ReadLine();
                           
                                try
                                {
                                    do
                                    {
                                        line1 = sr.ReadLine();
                                   
                                    } while (line1 != "");

                                }
                                catch { }

                                Console.WriteLine(username + " is " + sr.ReadLine());           
                                try
                                {
                                    while (true)
                                    {
                                        Console.WriteLine(sr.ReadLine());
                                   
                                    }
                                }
                                catch { }
                           
                            }
                   
                            else
                            {
                            Console.WriteLine("ERROR: no entries found");
                            }

Answers (3)