Member1

Member1

  • NA
  • 169
  • 51k

How to fix error ,"Unreachable code detected."

Jul 17 2015 3:17 AM
I written a server program for  multiple client connection and I got above error in one method . I tried some options like "#pragma warning disable " but it doesn't works. Please give me suggestions to fix this. 
Thanks ! 
 
here is my code, 
 
public void startServer()
{
        int port = Convert.ToInt32(txtport.Text);
         string ipaddre = getip();
         IPAddress iP = IPAddress.Parse(ipaddre);
      TcpListener serverSocket = new TcpListener(iP, port);
      TcpClient clientSocket = default(TcpClient);
      int counter = 0;
      serverSocket.Start();
      AppendTxtdata("Server Started , Waiting for Client Connection");
      counter = 0;
      #pragma warning disable
      while (true)
      {
                counter += 1;
               clientSocket = serverSocket.AcceptTcpClient();
               AppendTxtdata(" >> " + "Client No:" + Convert.ToString(counter) + " Connected-- IP -                "+clientSocket.Client.RemoteEndPoint.ToString()+"");
               AppendTxtdata(Environment.NewLine);
               handleClient client = new connectSuccess.handleClient();
               client.startClient(clientSocket, Convert.ToString(counter));
      }
          AppendTxtdata("Data sent to Client No :" + Convert.ToString(counter));
         clientSocket.Close();
         serverSocket.Stop();
         AppendTxtdata(" >> " + "exit");
         #pragma warning restore
}