Beispiel #1
0
 private void buttonsendl_Click(object sender, EventArgs e)
 {
     if (checkstationid())
     {
         try
         {
             int  count  = Convert.ToInt32(textBoxsendl.Text) - 1;
             uint taskid = Taskid;
             tasklist.Add(taskid, DateTime.Now);
             for (int i = 0; i < count + 1; i++)
             {
                 testpacket p = new testpacket();
                 p.taskid = taskid;
                 if (i == count)
                 {
                     p.isEnd = true;
                 }
                 p.senderServerid = cc.LocalServerid;
                 p.recvServerid   = cc.StationIdtoServerid(stationid);
                 p.type           = PacketType.ldata;
                 p.data           = new byte[20971520];
                 cc.Send(stationid, p);
                 sendreports[p.recvServerid].Send(PacketType.ldata);
             }
         }
         catch (FormatException ex)
         {
             MessageBox.Show("请输入正确的数字");
         }
     }
 }
Beispiel #2
0
        void handlereceivedata(testpacket Data)
        {
            switch (Data.type)
            {
            case PacketType.sdata:
                receivereports[Data.senderServerid].Receive(Data.type);
                break;

            case PacketType.mdata:
                receivereports[Data.senderServerid].Receive(Data.type);
                break;

            case PacketType.ldata:
                receivereports[Data.senderServerid].Receive(Data.type);
                break;

            case PacketType.text:
                textBox8.AppendText(Data.text);
                break;

            case PacketType.file:
                saveFileDialog1.FileName = Data.text;
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    File.WriteAllBytes(saveFileDialog1.FileName, Data.data);
                }
                break;

            default:
                break;
            }
        }
Beispiel #3
0
 private void sendtext()
 {
     if (checkstationid())
     {
         testpacket p = new testpacket();
         p.type = PacketType.text;
         p.text = textBox7.Text;
         cc.Send(stationid, p);
         textBox7.Clear();
     }
 }
Beispiel #4
0
 private void button17_Click(object sender, EventArgs e)
 {
     if (checkstationid())
     {
         if (openFileDialog1.ShowDialog() == DialogResult.OK)
         {
             testpacket p = new testpacket();
             p.type = PacketType.file;
             p.text = openFileDialog1.SafeFileName;
             p.data = File.ReadAllBytes(openFileDialog1.FileName);
             cc.Send(stationid, p);
         }
     }
 }
Beispiel #5
0
 private void sendtext()
 {
     if (checkstationid())
     {
         testpacket p = new testpacket();
         p.type = PacketType.text;
         p.text = textBox7.Text;
         cc.Send(stationid, p);
         textBox7.Clear();
     }
 }
Beispiel #6
0
 void handlereceivedata(testpacket Data)
 {
     switch (Data.type)
     {
         case PacketType.sdata:
             receivereports[Data.senderServerid].Receive(Data.type);
             break;
         case PacketType.mdata:
             receivereports[Data.senderServerid].Receive(Data.type);
             break;
         case PacketType.ldata:
             receivereports[Data.senderServerid].Receive(Data.type);
             break;
         case PacketType.text:
             textBox8.AppendText(Data.text);
             break;
         case PacketType.file:
             saveFileDialog1.FileName = Data.text;
             if (saveFileDialog1.ShowDialog() == DialogResult.OK)
             {
                 File.WriteAllBytes(saveFileDialog1.FileName, Data.data);
             }
             break;
         default:
             break;
     }
 }
Beispiel #7
0
 private void buttonsends_Click(object sender, EventArgs e)
 {
     if (checkstationid())
        {
        try
        {
            int count = Convert.ToInt32(textBoxsends.Text) - 1;
            uint taskid = Taskid;
            tasklist.Add(taskid, DateTime.Now);
            for (int i = 0; i < count + 1; i++)
            {
                testpacket p = new testpacket();
                p.taskid = taskid;
                if (i == count) p.isEnd = true;
                p.senderServerid = cc.LocalServerid;
                p.recvServerid = cc.StationIdtoServerid(stationid);
                p.type = PacketType.sdata;
                p.data = new byte[1024];
                cc.Send(stationid, p);
                sendreports[p.recvServerid].Send(PacketType.sdata);
            }
        }
        catch (FormatException ex)
        {
            MessageBox.Show("请输入正确的数字");
        }
        }
 }
Beispiel #8
0
 private void button17_Click(object sender, EventArgs e)
 {
     if (checkstationid())
     {
         if (openFileDialog1.ShowDialog() == DialogResult.OK)
         {
             testpacket p = new testpacket();
             p.type = PacketType.file;
             p.text = openFileDialog1.SafeFileName;
             p.data = File.ReadAllBytes(openFileDialog1.FileName);
             cc.Send(stationid, p);
         }
     }
 }