public Form1() { InitializeComponent(); String HostName = Dns.GetHostName(); IPHostEntry ipEntry = Dns.GetHostByName(HostName); IPAddress[] addresses = ipEntry.AddressList; IPAddress addr = IPAddress.Parse("127.0.0.1"); foreach (IPAddress a in addresses){ if (a.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { addr = a; break; } } Basic = new BasicClient(19999, 9587, addr); client = new TCPClient(Basic); serv = new TCPServer(Basic); //serv = new SelectServer(Managers.ROUTING_TYPE.onion, DateTime.Parse("00:00:05"), 19999, 1456, addr); udp_serv = new UDPServer(Basic, HostName, serv.getpublickey()); serv.Run(); //Запускаем TCP сервер обработки udp_serv.Run(); //Запускаем UDP сервер рассылки IP //MessageBox.Show("UDP Run"); //MessageBox.Show("Server Run"); serv.NewMessageEvent += new NewMessageDelegate(Handler); client.ScanHosts(1); //Поиск доступных хостов //MessageBox.Show("Scanhosts Run"); HostsToPictures(); //client.SendString("Приветик", new Workstation(serv.CurrentIP, serv.getpublickey())); //client.SendString("Ты тут?", new Workstation(serv.CurrentIP, serv.getpublickey())); }
public Condition(BasicClient client, TCPServer server) { InitializeComponent(); Basic = client; serv = server; UDPport.Text = Basic.UDPport.ToString(); TCPport.Text = Basic.port.ToString(); UDPmask.Text = Basic.UDPmask; RefreshTime.Text = Basic.RefreshTime.ToString(); TimeOut.Text = Basic.WaitTime.ToString(); MaxNode.Text = Basic.MaxNodes.ToString(); Layers.Text = Basic.LayerCount.ToString(); MaxConnections.Text = Basic.MaxConnections.ToString(); FakeMessages.Checked = Basic.SendFakePackages; KeyRefreshTime.Text = Basic.KeyRefreshTime.ToString("R"); }
//SelectServer server; public Chat(Workstation Current, TCPClient client, TCPServer server) { InitializeComponent(); CurrentWorkstation = Current; this.client = client; this.server = server; pictureBox1.BackgroundImage = Image.FromFile(Current.PictureFile); label2.Text = Current.name; this.Text = "Чат с "+ Current.name; if (Current.couner > 0) { history.Text = Current.name + ": " + Current.buffer; Current.buffer = ""; Current.couner = 0; } //server.NewMessageEvent += new NewMessageDelegate(Handler); }