I'm trying to develop a program in C# that will change 'label1' in my
form to "online" if a server is present on 127.0.0.1:8080 and "offline"
if it is not.
I was playing around with this:
public static bool UrlIsValid(string smtpHost)
{
bool br = false;
try
{
IPHostEntry ipHost = Dns.Resolve(smtpHost);
br = true;
}
catch (SocketException se)
{
MessageBox.Show (se.Message);
br = false;
}
return br;
}
but that only resolves the hostname.. hence it always returns "offline"
does anyone have a better way of doing this? if there was a 'ping'
command that would probably solve this, but i would need some way to
test the ping return, see where i'm going, this has me quite confused.
Any Help would be appreciated.
~ Kotori