public InterCcCommunicationServer(NCC ncc) { this.ncc = ncc; ipAddress = Dns.GetHostEntry(ip).AddressList[0]; server = new TcpListener(ipAddress, port); server.Start(); new Thread(StartListening).Start(); }
public ParentConnection(TcpClient client, NCC ncc) { this.client = client; this.ncc = ncc; stream = client.GetStream(); reader = new StreamReader(stream); writer = new StreamWriter(stream); new Thread(RecieveMessages).Start(); }
public Server(NCC ncc) { this.ncc = ncc; ipAddress = Dns.GetHostEntry(ip).AddressList[0]; server = new TcpListener(ipAddress, port); //TODO: tu jakiś konfig wczytujemy GUIWindow.PrintLog("Control center is waiting for connections..."); server.Start(); new Thread(StartListening).Start(); }
public HostConnection(Host host, TcpClient client, int id, Server server, NCC ncc) { this.host = host; this.client = client; this.id = id; this.server = server; this.ncc = ncc; stream = client.GetStream(); reader = new StreamReader(stream); writer = new StreamWriter(stream); new Thread(RecieveMessages).Start(); }
static void Main(String[] args) { try { args = Environment.GetCommandLineArgs(); new Thread(() => { Thread.Sleep(1000); try { String config = String.Concat(File.ReadAllLines(args[1])); ConfigLoader.loadConfig(config, args[2]); //String config = String.Concat(File.ReadAllLines("./../../../../sharedResources/tsst_config.xml")); //ConfigLoader.loadConfig(config, "1"); //String config = String.Concat(File.ReadAllLines("./../../../../sharedResources/tsst_config.xml")); //ConfigLoader.loadConfig(config); //String config = String.Concat(File.ReadAllLines(args[1])); //ConfigLoader.LoadConfig(config, args[2]); ncc = new NCC(); server = new Server(ncc); if (ConfigLoader.ccID == 2) { interCCServer = new InterCcCommunicationServer(ncc); } else if (ConfigLoader.ccID == 1) { peerConnection = new PeerConnection(new TcpClient("localhost", 12500), true, ncc); } else { childConnection = new ChildConnection(new TcpClient("localhost", 12500), ncc); } GUIWindow.UpdateChannelTable(); } catch (Exception e) { GUIWindow.PrintLog(e.StackTrace); } }).Start(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new GUIWindow()); } catch (Exception ex) { GUIWindow.PrintLog(ex.StackTrace); } }
public PeerConnection(TcpClient client, bool register, NCC ncc) { this.client = client; this.ncc = ncc; stream = client.GetStream(); reader = new StreamReader(stream); writer = new StreamWriter(stream); if (register) { Register(); } new Thread(RecieveMessages).Start(); //try { // new Thread(() => { // Thread.Sleep(100); // Program.rc.SendNetworkTopology(); // }).Start(); //} catch(Exception e) { // GUIWindow.PrintLog(e.Message); // GUIWindow.PrintLog(e.StackTrace); //} }