Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi everyone ..
im creating application to check connection Status but my problem i must click button to get result so how it is possible to get replay or Continuously from that ping ,,
this is my code
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Net.NetworkInformation;

namespace ping_test_2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Ping p = new Ping();
            PingReply r;
            string s;
            s = textBox1.Text;
            r = p.Send(s);
            if (r.Status == IPStatus.Success)
            {
              listBox1.Items.Add( "Ping to " + s.ToString() + r.Address.ToString() + "]" + " Successful"
               + " Response delay = " + r.RoundtripTime.ToString() + " ms" + "\n");
              button2.BackColor = Color.Green;
            }
            else if (r.Status == IPStatus.TimedOut)
            {
                button2.BackColor = Color.Red;
            }
        }
    }
}

can anyone of you help me with this plz
Posted

 
Share this answer
 
Comments
Abhinav S 4-Apr-15 5:32am    
5.
jame01 4-Apr-15 5:49am    
you mean i set time to repeat this instruction
Mehdi Gholam 4-Apr-15 5:57am    
Yes.
 
Share this answer
 
Comments
Mehdi Gholam 4-Apr-15 5:34am    
My 5!
Abhinav S 4-Apr-15 5:36am    
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900