Beispiel #1
0
        void _newServer_OnClientAskForConnection(xConnection conn)
        {
            Console.WriteLine("[FORM] Connection Request");

            this.Invoke((MethodInvoker) delegate
            {
                string address = conn.socket.RemoteEndPoint.ToString();
                address        = address.Remove(address.IndexOf(':'));
                string msg     = "Accept New Connection request from: " + address + " ?";

                DialogResult result1 = MessageBox.Show(msg, "Connection Request", MessageBoxButtons.YesNo);
                if (result1 == System.Windows.Forms.DialogResult.Yes)
                {
                    _newServer.SetAuth(true, conn);
                    ClientUtil.AddClient(new AuthClient {
                        IPaddress = address, HostName = "temp"
                    });
                }
                else
                {
                    _newServer.SetAuth(false, conn);
                }
            });
        }