public void connectWithManager(NetworkNode nd, Form1 form1) { Agent agent = new Agent(nd, form1); form1.Data(DateTime.Now.ToLongTimeString() + ":" + DateTime.Now.Millisecond.ToString() + "Connect With Manager"); agent.Start(); }
public Agent(NetworkNode _nd, Form1 _form) { nd = _nd; LabelAction la = new LabelAction(_nd); form = _form; }
public NetworkNode ReadRouterConfig() { XmlTextReader reader = null; try { var content = Environment.GetCommandLineArgs()[1]; reader = new XmlTextReader(content); } catch { reader = new XmlTextReader("..\\..\\..\\..\\Config\\config3.xml"); } //var content = Environment.GetCommandLineArgs()[1]; //XmlTextReader reader = new XmlTextReader("..\\..\\..\\..\\Config\\config1.xml"); //XmlTextReader reader = new XmlTextReader(content); //var content = Environment.GetCommandLineArgs()[1]; // XmlTextReader reader = new XmlTextReader("..\\..\\..\\..\\Config\\config1.xml"); //XmlTextReader reader = new XmlTextReader(content); while (reader.Read()) { if (reader.Name.Equals("managerIP")) { reader.Read(); table2[0] = reader.Value; reader.Read(); } else if (reader.Name.Equals("managerPort")) { reader.Read(); Int32.TryParse(reader.Value, out table[0]); reader.Read(); } else if (reader.Name.Equals("nodeName")) { reader.Read(); table2[1] = reader.Value; reader.Read(); } else if (reader.Name.Equals("cloudIP")) { reader.Read(); table2[2] = reader.Value; reader.Read(); } else if (reader.Name.Equals("cloudPort")) { reader.Read(); Int32.TryParse(reader.Value, out table[1]); reader.Read(); } } //reader.Close(); NetworkNode nd = new NetworkNode(table2[1], table2[0], table[0], table2[2], table[1]); return(nd); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form1 form1 = new Form1(); NetworkNode nd = new NetworkNode(); ReadConfig rd = new ReadConfig(); nd = rd.ReadRouterConfig(); form1.Text = nd.name; Task responseTask = Task.Run(() => nd.connect(nd, form1, "127.0.0.1")); Task responseTask2 = Task.Run(() => nd.connectWithManager(nd, form1)); //responseTask.ContinueWith(t => Console.WriteLine("In ContinueWith")); //responseTask.Wait(); // Task.Run(() => nd.sendPacket(nd, form1, "127.0.0.1")); Application.Run(form1); }
public ConnectWithCloud(NetworkNode _nd, Form1 form1, string ip1) { form = form1; nd = _nd; ip = ip1; }
public LabelAction(NetworkNode network) { nd = network; }
public void sendPacket(NetworkNode nd, Form1 form1, string ip) { // ConnectWithCloud connect = new ConnectWithCloud(nd, form1, ip); // connect.send(); }
public void connect(NetworkNode nd, Form1 form1, string ip) { ConnectWithCloud connect = new ConnectWithCloud(nd, form1, ip); connect.connectWithCloud(); }