Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
For Eg:
i was logged in as abc@gmail.com in www.gmail.com website,
and my friend was logged in as def@gmail.com by googletalk in another system,

Solution Need:
how could I ping the windows application from website using c#?
Posted
Comments
_Amy 7-Jun-13 2:04am    
That's called networking. Refer Connecting applications over network[^].
riodejenris14 7-Jun-13 2:10am    
hello amy!!!! thanks but do we ant to alter our web application and also the windows application accordingly????

Quote:
how could I ping the windows application from website using c#?


You can not ping any application.It is server that responds PING requests.If you know server address either in domain name form or in IP form you can ping it using web application or window application.

here is sample code,
C#
private void getvalue(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
                pingip = dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString();
                Ping ping = new Ping();
                PingReply pingReply = ping.Send(pingip);
                if(pingReply.Status==IPStatus.Success)
               {
                   
                label1.Text = pingReply.Address.ToString();
                label2.Text = pingReply.RoundtripTime.ToString();
                label3.Text = pingReply.Status.ToString();
                row.DefaultCellStyle.BackColor = Color.Green;
               }
                else
                {
                    //this.Cursor = Cursors.WaitCursor;
                    label1.Text = "Request Time Out";
                    label2.Text = pingReply.RoundtripTime.ToString();
                    label3.Text = pingReply.Status.ToString();
                }
                this.Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
            }
        }
 
Share this answer
 
v2
Comments
riodejenris14 7-Jun-13 2:12am    
thanks uma shankar!!! can u explain me with sample code...
uspatel 7-Jun-13 2:24am    
Check updated answer,
I think, you will not face any difficulties to understand that.
riodejenris14 7-Jun-13 2:34am    
I had developed website application with chat functionality and also i had developed the windows application for chat. How do i get the IP to connect between these nodes over the network? pingip is the value in grid, do you want me to take the IP and bind over my grid?
uspatel 7-Jun-13 2:47am    
No i do'nt want you to take the IP and bind over your grid?It is just an example to ping programmatically.
Access the same DB which is common for web and windows application through webservice if need.
 
Share this answer
 

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