public void getRunMsg(String msg) { try { MessageGenerator temp = new MessageGenerator(); string pid = " "; string ipport = ""; string reply = ""; XDocument xml = XDocument.Parse(msg); var q = from x in xml.Elements() select x; //var q = from x in xml.Elements().Descendants("root") select x; pid = q.ElementAt(0).Attributes().ElementAt(1).Value; ipport = q.ElementAt(0).Attributes().ElementAt(2).Value; SwarmMemory sm = GetProg(pid.ToString()); if (sm.getRunFlag() == false) { sm.setRunFlag(true); reply = temp.msgRunSucessReply(pid); } else { reply = temp.msgRunFailReply(pid); } if (ipport != "") { string[] target = ipport.Split(':'); string ip = target[0]; string port = target[1]; AsynchronousClient client = new AsynchronousClient(); client.SetSingleMsg(ip, port, reply); Thread t; t = new Thread(new ThreadStart(client.SendSingleClient)); t.IsBackground = true; t.Start(); } } catch (Exception e) { Console.WriteLine(e.ToString()); } }