コード例 #1
0
ファイル: AS.xaml.cs プロジェクト: sunshine388/Kerberos
        public void SendMessage(object clientSocket)
        {
            Socket     myClientSocket = (Socket)clientSocket;
            IPEndPoint iprm           = (IPEndPoint)connection.RemoteEndPoint;
            Message    c = DealMsg1(Encoding.ASCII.GetString(result));

            //Message b = new Message();
            if (c.type == "01")
            {
                c.dealMsg(c);
                c.msg2_tkt_ADc = iprm.Address.ToString();
                c.msg2_TS2     = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                //this.Dispatcher.Invoke(new Action(() => { TextBox1.AppendText(c.msg2_TS2); }));
                this.Dispatcher.Invoke(new Action(() => { TextBox2.AppendText(c.MMessage(c)); }));
                string ssmg;
                ssmg = c.ssMessage(c);
                this.Dispatcher.Invoke(new Action(() => { TextBox4.AppendText(ssmg); }));
                // this.Dispatcher.Invoke(new Action(() => { TextBox1.AppendText(ssmg.Length.ToString()); }));
                //  string Cssmg;
                // Cssmg = c.ssMessage1(c);
                // this.Dispatcher.Invoke(new Action(() => { TextBox4.AppendText(Cssmg); }));
                Byte[] ssmg2 = new byte[1024];
                ssmg2 = Encoding.ASCII.GetBytes(ssmg);
                //int num1 = myClientSocket.Send(ssmg1);
                myClientSocket.Send(ssmg2, ssmg2.Length, 0);
                myClientSocket.Close();
            }
            if (c.type == "13")
            {
                //c.dealMsg(c);
                c.msg14_TS = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                string ssmg3 = c.SSMessage14(c);
                this.Dispatcher.Invoke(new Action(() => { TextBox2.AppendText(c.MMessage14(c)); }));
                Byte[] ssmg1 = new byte[1024];
                ssmg1 = Encoding.ASCII.GetBytes(ssmg3);
                myClientSocket.Send(ssmg1, ssmg1.Length, 0);
            }
            //myClientSocket.Close();
        }
コード例 #2
0
ファイル: TGS.xaml.cs プロジェクト: sunshine388/Kerberos
        public void SendMessage(object clientSocket)
        {
            Socket     myClientSocket = (Socket)clientSocket;
            IPEndPoint iprm           = (IPEndPoint)connection.RemoteEndPoint;
            Message    c = DealMsg1(Encoding.ASCII.GetString(result));

            //Message b = new Message();
            if (c.type == "03")
            {
                // this.Dispatcher.Invoke(new Action(() => { TextBox2.AppendText(c.msg3_tgt); }));
                c.dealMsg(c);
                c.msg4_key     = Y.GetRandomString(8);
                c.msg4_tkt_ADc = iprm.Address.ToString();
                c.msg4_ts4     = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                this.Dispatcher.Invoke(new Action(() => { TextBox2.AppendText(c.MMessage4(c)); }));
                string ssmg;
                ssmg = c.ssMessage4(c);
                this.Dispatcher.Invoke(new Action(() => { TextBox4.AppendText(ssmg); }));
                Byte[] ssmg3 = new byte[1024];
                ssmg3 = Encoding.ASCII.GetBytes(ssmg);
                myClientSocket.Send(ssmg3, ssmg3.Length, 0);
                // myClientSocket.Close();
            }
        }