-- ping by ip address, not host name -- (or how do I add an IP address to a IPHostEntry object)

  • Thread starter Thread starter techprot-google04
  • Start date Start date
T

techprot-google04

I've found tons of sample code on pinging - but all start with the host
name, resolve the ip address and do the ping.

Does anyone have any sample code that does a ping from an ip address
alone?

OR

Does anyone know how to add an ip address to the the address list of an
IPHostEntry object? I've tried ihe.AddressList[0] =... but I can't
seem to figure out how to pass the ip address.

If I can do this, then I pass the ip address and use the code I've
found online.

Thanks!

Andrew
 
GetHostByName not only works with domain names, but also takes an IP address
in dotted decimal, e.g., "1.2.3.4". It returns the proper IPHostEntry
object. For example, if you are getting your domain or IP address for a ping
from a text box you can just pass this to GetHostByName. If you have a built
in IP address to ping just set it up as a string literal. There are other
ways to do all this, but I think this is closer to what you want.

Thomas P. Skinner [MVP]
 
Back
Top