PowerTCP Sockets for .NET

from $349.00
Available Platforms
<

Ping Code Example

See all PowerTCP Sockets for .NET Samples and Code Examples

 

The following C# example demonstrates a ping operation in a console environment.

 

PingSlave pingSlave1 = new PingSlave(System.Net.IPAddress.Any, Ping.Type.System);
string pingTarget = "www.dart.com";

//Ping the target with no optional data, a 20 second hop TTL and a 5 second timeout.
Echo[] echoes = pingSlave1.GetEchoes(new Dart.Sockets.IPEndPoint(pingTarget, 0).Address, null, 20, 5000, false);

//This event is raised when a GetEchoes result is passed to the UI.
string results = "The following echoes were returned:\r\n";
for (int i = 0; i < echoes.Length; i++)
    results += echoes[i].ToString() + "\r\n";
Console.WriteLine(results);

Console.WriteLine("Press <enter> to exit.");
Console.ReadLine(); 

To download a trial please visit the PowerTCP Sockets for .NET product page.