How do I ping classic servers?
Posted: 18 Dec 2013, 20:47
I know how to find out the IP and Port of a server and I want to use mine in a program to determine whether it's online or offline. This is one of my attempts:
My other attempt was using a thing like:
But when I enter an IP:Port it will always show offline!.. How do I make this work?
- Code: Select all
private void button1_Click(object sender, EventArgs e)
{
WebClient webClient = new WebClient();
try
{
byte[] result = webClient.DownloadData(URLtext.Text);
label1.Text = "Online";
}
catch
{
label1.Text = "Offline";
}
}
My other attempt was using a thing like:
- Code: Select all
var ping = new System.Net.NetworkInformation.Ping();
var result = ping.Send("www.google.com");
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
return;
But when I enter an IP:Port it will always show offline!.. How do I make this work?