/// <summary>
 /// /////////////////////////////////////////////////////////////
 /// Sender thread function for sending analysis request to the server
 
 public void ClientSenderMain1(object arr)
 {
     List<string> arr1 = (List<string>)arr;
     CommunicationPrototype.Client client = new CommunicationPrototype.Client();
     foreach (string serv in connectedservers_)
     {
         try
         {
             string url = "http://localhost:" + serv.Substring(serv.IndexOf(" ")+1) + "/ICommService/BasicHttp";
             Console.Write("\n  connecting to \"{0}\"\n", url);
             client.CreateBasicHttpChannel(url);
             CommunicationPrototype.Message msg = new CommunicationPrototype.Message();
             string str1="";
             foreach (string str in arr1)
                 str1 += str+" ";  
             msg.text = portno_+":"+str1;
             if (recurse_ == true)
                 msg.text += ":/S";
             client.channel_.PostMessage(msg);
             connectedservers1_.Add(serv);
         }
         catch (Exception ex)
         {
             Console.Write("{0}",ex.Message);
         }
     }
     if (connectedservers_.Count == 0)
         noservers_ = true;
 }
 /// <summary>
 /// ///////////////////////////////////////////////////////////////////////
 /// Sender Thread for sending the request for getting list of projects.
 
 public void ClientSenderMain(object arr)
 {
     List<string> arr1 = (List<string>)arr;
     CommunicationPrototype.Client client = new CommunicationPrototype.Client();
     foreach (string str in arr1)
     {
         try
         {
             string url = "http://localhost:" + str + "/ICommService/BasicHttp";
             Console.Write("\n  connecting to \"{0}\"\n", url);
             client.CreateBasicHttpChannel(url);
             CommunicationPrototype.Message msg = new CommunicationPrototype.Message();
             msg.text = "GetProjects:"+portno_+":" + patt_;
             client.channel_.PostMessage(msg);
             ((ICommunicationObject)client.channel_).Close();
             connectedservers_.Add(str);
         }
         catch (Exception ex)
         {
             Console.Write("{0}", ex.Message);
         }
         Console.Write("\n\n");
     }
     if (connectedservers_.Count == 0)
         noservers_ = true;
 }
   /// <summary>
   /// /////////////////////////////////////////////////
   /// Snder Thread function
 public void ServerSender(string port, string data)
 {
     Console.Write("\n  BasicHttpClient Starting to Post Messages to Service");
     Console.Write("\n ======================================================\n");
     Client client = new Client();
     try
     {
         string url = "http://localhost:"+port+"/ICommService/BasicHttp";
         Console.Write("\n  connecting to \"{0}\"\n", url);
         client.CreateBasicHttpChannel(url);
         Message msg = new Message();
         msg.text = data;
         client.channel.PostMessage(msg); 
     }
     catch (Exception ex)
     {
         Console.Write("\n\n  {0}", ex.Message);
     }
     Console.Write("\n\n");
 }
   /// <summary>
   /// /////////////////////////////////////////////////////////////
   /// Server Reciever thread
 public virtual void ThreadProc()    {
     Message msg = new Message();
     while (msg.text!="quit")        {
         msg = this.GetMessage();
         string data = msg.text;
         if (msg.text.Contains("GetProjects"))            {
             clientconnect cc = new clientconnect();
             cc.connected = true;
             data = data.Substring(data.IndexOf(":") + 1);
             cc.portno = data.Substring(0, data.IndexOf(":"));
             if (data.Length > data.IndexOf(":")+3)                {
                 string patt = data.Substring(data.IndexOf(":") + 1);
                 cc.patt_.Add(patt);
             }
             string data1="";
             foreach (string str in FieMgrMain("./../../TestProjects"))
                 data1 += str + " ";
             Thread.Sleep(500);
             connectedclients_.Add(cc);
             ServerSender(cc.portno,data1);
         }
         else            {
             foreach (clientconnect cc in connectedclients_)                {
                 if (cc.portno == data.Substring(0, data.IndexOf(":")))                    {
                     data=data.Substring(data.IndexOf(":")+1);
                     if (data.IndexOf(":") != -1)
                     {
                         cc.recurse_ = true;
                         data = data.Substring(0, data.IndexOf(":"));
                     }
                     cc.analproj_.Clear();
                     while (data.IndexOf(" ") != -1)
                     {
                         cc.analproj_.Add(data.Substring(0, data.IndexOf(" ")));
                         data=data.Substring(data.IndexOf(" ")+1);
                     }
                     analyzercall(cc);
                     ServerSender(cc.portno,cc.data_);
                     connectedclients_.Remove(cc);
                     break;
                 }
             }
         }
         //if (msg.text == "quit")
         //    msg.text = "";
     }
     msg.text = xmldata_;       
 }
 public void PostMessage(Message msg)
 {
  // IdentifyClient();
   BlockingQ.enQ(msg);
 }
        /// <summary>
        /// ////////////////////////////////////////////////////////////////////////
        /// Reciever Thread function for getting the analysis function from the server

        public void ClientRecieverMain1(ref List<string> a)
        {
            Console.Write("\n  Communication Server Starting up");
            Console.Write("\n ==================================\n");
            List<string> projects = new List<string>();
            CommunicationPrototype.Client cl = new CommunicationPrototype.Client();
                try
                {
                    CommService service = new CommService();
                    BasicHttpBinding binding0 = new BasicHttpBinding();
                    Uri address0 = new Uri("http://localhost:" + portno_ + "/ICommService/BasicHttp");
                    using (service.host_ = new ServiceHost(typeof(CommService), address0))
                    {
                        service.host_.AddServiceEndpoint(typeof(ICommService), binding0, address0);
                        service.host_.Open();
                        Message msg = new Message();
                        msg.text = " ";
                        while (connectedservers1_.Count == 0)
                        {
                            if (noservers_)
                                return;
                        }
                        Thread.Sleep(1000);
                        int count = connectedservers1_.Count;
                        while (count != 0)
                        {
                            count--;
                            msg = service.GetMessage();
                            typetables_.Add(msg.text);
                            a.Add(msg.text);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.Write("\n  {0}\n\n", ex.Message);
                }
        }