Check out the following for Ping
How to determine if remote computer is availablehttp://msdn2.microsoft.com/en-us/library/s9xkzk4s(VS.80).aspx
These have examples which will probably help you.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?