예제 #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     button2.Enabled = false;
     DataSend ds = new DataSend(textBox3.Text,textBox4.Text);
     ds.sendData(textBox5.Text);
     button2.Enabled = true;
 }
        protected void Button1_Click(object sender, EventArgs e)
        {
            //Label1.Text = textarea1.InnerText +syntax_selection.SelectedIndex.ToString() +syntax_selection.Value.ToString();
            Label1.Text = textarea1.InnerText + syntax_selection.SelectedIndex.ToString() + syntax_selection.SelectedValue.ToString();
            Database db = new Database();
            MySqlDataReader rdr = null;
            rdr = db.SelectDataFromDatabase("select ipaddress from compilertype where name='" + syntax_selection.SelectedValue.ToString() + "'");
            if (rdr.HasRows)
            {

                if (rdr.Read())
                {

                    type1ip = rdr.GetString(0);
                }

            }

            //Label4.Text = "Your chose:" + DropDownList1.SelectedItem.Text + DropDownList1.SelectedIndex.ToString();
            int i = 0;

            i = db.InsertIntoDatabase("insert into crawler(prog,result,operation) values('" + textarea1.InnerText + "','0'," + (syntax_selection.SelectedIndex + 1).ToString() + ")");

            DataSend ds = new DataSend(type1ip, "5212");
            ds.sendData("  " + i.ToString());
            id = i;
            Button2.Visible = true;
        }
예제 #3
0
        public void SendTo()
        {
            FileStream   fs    = new FileStream(textBox4.Text, FileMode.Open, FileAccess.Read);
            BinaryReader read  = new BinaryReader(fs);
            FileInfo     fi    = new FileInfo(textBox4.Text);
            int          count = (int)(fi.Length / (1024 * 3)) + 1;

            NameSize ns = new NameSize();

            ns.name = fi.Name;

            ns.Type = (int)PacketType.이름과사이즈;
            Packet.Serialize(ns).CopyTo(this.sendBuffer, 0);
            this.Client_Send();

            progressBar1.Maximum = (int)fi.Length;

            for (int i = 0; i < count; i++)
            {
                DataSend ds = new DataSend();
                ds.data = read.ReadBytes(1024 * 3);
                ds.Type = (int)PacketType.일;

                progressBar1.Value += progressBar1.Maximum / count;

                Packet.Serialize(ds).CopyTo(this.sendBuffer, 0);
                this.Client_Send();
            }

            progressBar1.Value = 0;
        }
예제 #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     String serverip = "172.16.52.59";
     String serverport = "9000";
     DataSend ds = new DataSend(serverip, serverport);
     ds.sendData(@textBox1.Text);
 }
        public SendData_Analysis(DataOriginal insDataOri)
        {
            //Save original
            this.OriginalData = insDataOri;

            //Convert to class
            DataSend = new DataSend(this.OriginalData);
        }
예제 #6
0
        public void SendData(byte[] data)
        {
            SpecifiedOutputReport oRep = new SpecifiedOutputReport(this);

            oRep.SendData(data);
            Write(oRep);
            DataSend?.Invoke(this, new DataSendEventArgs(data));
        }
예제 #7
0
        public void Receive()
        {
            while (true)
            {
                m_NetStream.Read(readBuffer, 0, readBuffer.Length);

                Packet packet = (Packet)Packet.Deserialize(this.readBuffer);

                switch ((int)packet.Type)
                {
                case (int)PacketType.이름과사이즈:
                {
                    ListViewItem item;

                    this.m_NameSize = (NameSize)Packet.Deserialize(this.readBuffer);
                    this.Invoke(new MethodInvoker(delegate()
                        {
                            item = listView1.Items.Add(m_NameSize.name);
                            item.SubItems.Add(m_NameSize.size.ToString());
                        }));

                    break;
                }

                case (int)PacketType.일이름:
                {
                    this.m_DataName = (DataName)Packet.Deserialize(this.readBuffer);

                    break;
                }

                case (int)PacketType.일:
                {
                    this.m_DataSend = (DataSend)Packet.Deserialize(this.readBuffer);

                    FileStream fs = new FileStream(textBox3.Text + "\\" + m_DataName.name, FileMode.Append, FileAccess.Write);
                    fs.Write(m_DataSend.data, 0, m_DataSend.data.Length);

                    this.Invoke(new MethodInvoker(delegate()
                        {
                            progressBar1.Value += (int)(progressBar1.Maximum / ((progressBar1.Maximum / (1024 * 3)) + 1));
                        }));

                    fs.Close();

                    if (m_DataSend.data.Length < 1024 * 3)
                    {
                        this.Invoke(new MethodInvoker(delegate()
                            {
                                progressBar1.Value = 0;
                            }));
                    }

                    break;
                }
                }
            }
        }
        public SendData_Analysis(byte[] byteOri)
        {
            //Save original
            DataOriginal dataOri = new DataOriginal();

            dataOri.Data      = byteOri;
            this.OriginalData = dataOri;

            //Convert to class
            DataSend = new DataSend(this.OriginalData);
        }
예제 #9
0
        public void Send(ref byte[] data, ref HttpListenerContext context)
        {
            context.Response.Headers.Add("Server", string.Empty);
            context.Response.Headers.Add("Date", string.Empty);

            context.Response.ContentLength64 = data.Length;
            context.Response.OutputStream.WriteAsync(data, 0, data.Length).ConfigureAwait(false);
            context.Response.OutputStream.Close();

            DataSend?.Invoke(this, new DataSendEventArgs());
        }
예제 #10
0
 static void Main(string[] args)
 {
     string ManagerIpAddress="172.16.52.125";
     string ManagerPortAddress="10000";
     DataReceive dr = new DataReceive("9000");
     string ipaddress=dr.ipaddress;
     string data = dr.getData();
     Console.WriteLine(data);
     DataSend ds = new DataSend(ManagerIpAddress,ManagerPortAddress);
     ds.sendData(ipaddress);
     ds.sendData(data);
 }
예제 #11
0
        static void Main(string[] args)
        {
            string      ManagerIpAddress   = "172.16.52.125";
            string      ManagerPortAddress = "10000";
            DataReceive dr        = new DataReceive("9000");
            string      ipaddress = dr.ipaddress;
            string      data      = dr.getData();

            Console.WriteLine(data);
            DataSend ds = new DataSend(ManagerIpAddress, ManagerPortAddress);

            ds.sendData(ipaddress);
            ds.sendData(data);
        }
    //internal System.Threading.WaitCallback startTread(ListBox ls)
    internal System.Threading.ThreadStart startTread(crawler.Employee.EmployeeGUI employeeGUI)
    {
        while (true)
        {
            while (StackIpaddress.ManagerIpAddress.Count == 0) ;
            while (StackIpaddress.ClerkIpAddress.Count == 0) ;
            String managerip = StackIpaddress.ManagerIpAddress.Dequeue();
            String Clerkip = StackIpaddress.ClerkIpAddress.Dequeue();
            DataSend ds = new DataSend(Clerkip, "5211");
            ds.sendData(managerip);
            employeeGUI.RemoveToListBoxClerk(Clerkip);
            employeeGUI.RemoveToListBoxManager(managerip);
            employeeGUI.AddToStatus(" JOB ALLOCATED TO :"+Clerkip+" ( "+managerip+")") ;

        }
        throw new NotImplementedException();
    }
    //internal System.Threading.WaitCallback startTread(ListBox ls)
    internal System.Threading.ThreadStart startTread(clerk.ClerkGUI c)
    {
        while (true)
        {
            n = c;
            //Requesting for Sending Data //
            c.AddToTextBox("Data Send to : "+c.getIp());
            DataSend ds = new DataSend(c.getIp(), "5210");
            ds.sendData("Free");
            //Requesting For
            c.AddToTextBox("\nData Successfully Sent to : " + c.getIp());
            DataReceive dr = new DataReceive("5211");
            c.AddToTextBox("\nData Received"+dr.getData()+"from ip-address"+dr.ipaddress);
            computeIt(dr.getData());

        }
        throw new NotImplementedException();
    }
예제 #14
0
        public override IActivity toActivity(string pCmd, object[] pArgs)
        {
            string _name = ToolObjectName.getName(pCmd);
            string _type = ToolObjectName.getType(pCmd);

            switch (_name)
            {
            case "tool.data.import":
                return(DataReceive.createDataReceive());

            case "tool.data.export":
                return(DataSend.createDataSend());
            }



            return(base.toActivity(pCmd, pArgs));
        }
예제 #15
0
파일: TcpServer.cs 프로젝트: radtek/datawf
        protected internal void OnDataSend(TcpServerEventArgs arg)
        {
            NetStat.Set("Server Send", 1, arg.Length);

            if (logEvents)
            {
                Helper.Logs.Add(new StateInfo("NetService", "DataSend", string.Format("{0} {1} {2}",
                                                                                      arg.Client.Socket.LocalEndPoint,
                                                                                      arg.Client.Socket.RemoteEndPoint,
                                                                                      Helper.TextDisplayFormat(arg.Length, "size"))));
            }

            DataSend?.Invoke(this, arg);

            if (arg.Stream is MemoryStream)
            {
                arg.Stream.Dispose();
            }
        }
 protected virtual void OnDataSend(SendDataEventArgs e)
 {
     DataSend?.Invoke(this, e);
 }
예제 #17
0
 protected virtual void OnDataSend(UdpServerEventArgs arg)
 {
     NetStat.Set("Data Send", 1, arg.Length);
     DataSend?.Invoke(this, arg);
 }
예제 #18
0
 void Send()
 {
     DataSend ds = new DataSend(ipaddress, port);
     ds.sendData("Free");
 }
예제 #19
0
 protected void OnDataSend(AsyncTCPClientEventArgs e, object data)
 {
     DataSend?.Invoke(data, e);
 }
예제 #20
0
        private void menuSend_Click(object sender, EventArgs e)
        {
            DataSend s = new DataSend(environment);

            s.done();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Database db = new Database(this);
            MySqlDataReader rdr = null;
            rdr = db.SelectDataFromDatabase("select ipaddress from compilertype where name='" + DropDownList1.SelectedItem.Text + "'");
            if (rdr.HasRows)
            {

                if (rdr.Read())
                {

                    type1ip = rdr.GetString(0);
                }

            }

            Label4.Text = "Your chose:" + DropDownList1.SelectedItem.Text+DropDownList1.SelectedIndex.ToString();
            int i = 0;

            i = db.InsertIntoDatabase("insert into crawler(prog,result,operation) values('" + TextBox1.Text + "','0'," + (DropDownList1.SelectedIndex+1).ToString() + ")");

            DataSend ds = new DataSend(type1ip, "5212");
            ds.sendData("  " + i.ToString());
            id = i;
            Button2.Visible = true;

            /*
            if (DropDownList1.SelectedItem.Text == "Sum")
            {

                rdr = db.SelectDataFromDatabase("select ipaddress from compilertype where name='Sum'");
                if (rdr.HasRows)
                {

                    if (rdr.Read())
                    {
                        //Label6.Text = "Data Result" + rdr.GetString(0);
                        //DropDownList1.Items.Add(rdr.GetString(0));
                        type1ip = rdr.GetString(0);
                    }

                }

                Label4.Text = "You choose:" + DropDownList1.SelectedItem.Text;
                int i = 0;

                i = db.InsertIntoDatabase("insert into crawler(prog,result,operation) values('" + TextBox1.Text + "','0',1)");
                Label4.Text = "Not updated" + i;
                DataSend ds = new DataSend(type1ip, "5212");
                ds.sendData("  "+i.ToString());
                id = i;
                Button2.Visible = true;

            }
            if (DropDownList1.SelectedItem.Text == "Sub")
            {
                rdr = db.SelectDataFromDatabase("select ipaddress from compilertype where name='Sub'");
                if (rdr.HasRows)
                {

                    if (rdr.Read())
                    {
                        //Label6.Text = "Data Result" + rdr.GetString(0);
                        //DropDownList1.Items.Add(rdr.GetString(0));
                        type2ip = rdr.GetString(0);
                    }

                }

                Label4.Text = "You choose:" + DropDownList1.SelectedItem.Text;
                int i = 0;
                db = new Database(this);
                //i = db.InsertIntoDatabase("insert into crawler(value1,value2,result,operation) values(" + TextBox1.Text + "," + TextBox2.Text + ",0,2)");
                i = db.InsertIntoDatabase("insert into crawler(prog,result,operation) values('" + TextBox1.Text + "','0',2)");
                Label4.Text = "Not updated" + i;
                DataSend ds = new DataSend(type2ip, "5212");
                ds.sendData("  " + i.ToString());
                id = i;
                Button2.Visible = true;
            }
            if (DropDownList1.SelectedItem.Text == "Multi")
            {
                rdr = db.SelectDataFromDatabase("select ipaddress from compilertype where name='Multi'");
                if (rdr.HasRows)
                {

                    if (rdr.Read())
                    {
                        //Label6.Text = "Data Result" + rdr.GetString(0);
                        //DropDownList1.Items.Add(rdr.GetString(0));
                        type3ip = rdr.GetString(0);
                    }

                }
                Label4.Text = "You choose:" + DropDownList1.SelectedItem.Text;
                int i = 0;
                db = new Database(this);
                //i = db.InsertIntoDatabase("insert into crawler(value1,value2,result,operation) values(" + TextBox1.Text + "," + TextBox2.Text + ",0,3)");
                i = db.InsertIntoDatabase("insert into crawler(prog,result,operation) values('" + TextBox1.Text + "','0',3)");
                Label4.Text = "Not updated" + i;
                DataSend ds = new DataSend(type3ip, "5212");
                ds.sendData("  " + i.ToString());
                id = i;
                Button2.Visible = true;
            }
            if (DropDownList1.SelectedItem.Text == "Div")
            {
                rdr = db.SelectDataFromDatabase("select ipaddress from compilertype where name='Div'");
                if (rdr.HasRows)
                {

                    if (rdr.Read())
                    {
                        //Label6.Text = "Data Result" + rdr.GetString(0);
                        //DropDownList1.Items.Add(rdr.GetString(0));
                        type4ip = rdr.GetString(0);
                    }

                }
                Label4.Text = "You choose:" + DropDownList1.SelectedItem.Text;
                int i = 0;
                db = new Database(this);
                //i = db.InsertIntoDatabase("insert into crawler(value1,value2,result,operation) values(" + TextBox1.Text + "," + TextBox2.Text + ",0,4)");
                i = db.InsertIntoDatabase("insert into crawler(prog,result,operation) values('" + TextBox1.Text + "','0',4)");
                Label4.Text = "Not updated" + i;
                DataSend ds = new DataSend(type4ip, "5212");
                ds.sendData("  " + i.ToString());
                id = i;
                Button2.Visible = true;
            }*/
        }
예제 #22
0
        public void Receive()
        {
            string fileName      = null;
            string itemName      = null;
            string itemName_Copy = null;

            while (true)
            {
                m_NetStream.Read(readBuffer, 0, readBuffer.Length);

                Packet          packet = (Packet)Packet.Deserialize(this.readBuffer);
                NameSize        m_Name;
                DoubleClickItem m_ItemName;

                switch ((int)packet.Type)
                {
                case (int)PacketType.이름과사이즈:
                {
                    m_Name   = (NameSize)Packet.Deserialize(this.readBuffer);
                    fileName = m_Name.name;

                    break;
                }

                case (int)PacketType.일:
                {
                    this.m_DataSend = (DataSend)Packet.Deserialize(this.readBuffer);

                    FileStream fs = new FileStream(textBox3.Text + "\\" + fileName, FileMode.Append, FileAccess.Write);
                    fs.Write(m_DataSend.data, 0, m_DataSend.data.Length);

                    fs.Close();

                    break;
                }

                case (int)PacketType.더블클릭:
                {
                    m_ItemName = (DoubleClickItem)Packet.Deserialize(this.readBuffer);
                    itemName   = m_ItemName.itemName;

                    /*if(itemName == itemName_Copy)
                     * {
                     *  MessageBox.Show("같은 파일이 있습니다.");
                     *  break;
                     * }
                     *
                     * itemName_Copy = itemName;*/

                    FileStream   fs    = new FileStream(textBox3.Text + "\\" + itemName, FileMode.Open, FileAccess.Read);
                    BinaryReader read  = new BinaryReader(fs);
                    FileInfo     fi    = new FileInfo(textBox3.Text + "\\" + itemName);
                    int          count = (int)(fi.Length / (1024 * 3)) + 1;

                    DataName dsn = new DataName();
                    dsn.name = fi.Name;

                    dsn.Type = (int)PacketType.일이름;
                    Packet.Serialize(dsn).CopyTo(this.sendBuffer, 0);
                    this.Send();

                    for (int i = 0; i < count; i++)
                    {
                        DataSend ds = new DataSend();
                        ds.data = read.ReadBytes(1024 * 3);
                        ds.Type = (int)PacketType.일;

                        Packet.Serialize(ds).CopyTo(this.sendBuffer, 0);
                        this.Send();
                    }

                    fs.Close();;

                    break;
                }
                }
            }
        }