Pinging Computers on a local Network from ASP.NET

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a way to ping an IP address from an ASP.NET page to verify that it is not in use. This is one example given to me earlier, but unfortunetly I do not know C#. Could someone translate this into VB for me? or perhaps know of another way to easily ping an IP from an ASP.NET page.

Thanks Devin

Found at http://www.asp.net/ControlGallery/ControlDetail.aspx?Control=2069&tabindex=2

PingClient client = new PingClient();

PingReply reply = client.Ping("www.example.com");

if (reply.Success)
{
string message = "Reply took " + reply.Time + " milliseconds");
}
 
You don't have to be a rocket scientist to translate from C# to VB.net, c'mon the code you posted is all to easy, just look at it!
PingClient client = new PingClient();
'this is obviously a declaration, so in vb.net
Dim client as PingClient = new PingClient
PingReply reply = client.Ping("www.example.com");
'Here is another declaration
Dim reply as PingReplay = client.Ping("www.example.com")

'Please tell me you know how to make an if statement
if reply.success = true then
message = "Reply took " & reply.Time & " milliseconds")
end if

??? just confused that you couldn't figure that out for yourself...am I missing something?
--Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top