How To Check the host/Server Ip is accessible in the network

private Boolean CheckHost(String IpAdds)
{

try{
lbldesc1.Text =
"Verifying host kindly be patient";lbldesc1.UpdateLayout();

// Allow an Application To determine whether a remote computer is accessible over the networkPing oPingsnd = new Ping();

PingReply oPingRply = oPingsnd.Send(IpAdds);

// provide the information about the status and data resulting from a overload
if (oPingRply.Status == IPStatus.TimedOut){

return false;}

else if (oPingRply.Status == IPStatus.Success){
lbldesc1.Text =
"Host Verified, saving changes";lbldesc1.UpdateLayout();

return true;}
}

catch (Exception){

return false;}

finally{

GC.SuppressFinalize(true);}

return true;}

Comments