Home | Contact Us | Download | Support | Purchase | Products

Product List
  "Ok that seemed to have fixed the problem with the timezone. I'll continue testing it with my users but the few tests I did worked correctly. Thank you for working on this issue so diligently with me Dave. You have developed a great product and have offered great support to back it up."
D. Pichardo

Asynchronous Ping

The following example demonstrates asynchronously ping a host.


using System;
using aspNetPing;
namespace ConsoleApplication1
	class Class1
		static void Main(string[] args)
			IcmpClient icmp = new IcmpClient();
			IAsyncResult result = icmp.BeginExecute( "www.yahoo.com", 4, -1, new AsyncCallback( MyCallback ), icmp );

			Console.WriteLine( "done.");

		static void MyCallback( IAsyncResult result )
				IcmpClient icmp = (IcmpClient)result.AsyncState;
				ReplyPacketCollection rpc = icmp.EndExecute( result );
				Console.WriteLine( rpc.ToString() );
			catch( Exception ex )
				Console.WriteLine( ex.Message );



Imports System
Imports aspNetPing
Module Module1

    Sub Main()
        Dim icmp As New IcmpClient()
        Dim result As IAsyncResult = icmp.BeginExecute("www.yahoo.com", 4, -1, AddressOf MyCallback, icmp)


    End Sub

    Sub MyCallback(ByVal result As IAsyncResult)
            Dim icmp As IcmpClient = CType(result.AsyncState, IcmpClient)
            Dim rpc As ReplyPacketCollection = icmp.EndExecute(result)
        Catch ex As Exception
        End Try
    End Sub 'MyCallback

End Module







The box is not shipped. aspNetPing is a downloadable product.