System.Net.NetworkInformation.Ping.SendAsync C# (CSharp) Method

SendAsync() public method

public SendAsync ( System address, int timeout, byte buffer, System options, object userToken ) : void
address System
timeout int
buffer byte
options System
userToken object
return void
        public void SendAsync(System.Net.IPAddress address, int timeout, byte[] buffer, System.Net.NetworkInformation.PingOptions options, object userToken) { }
        public void SendAsyncCancel() { }

Same methods

Ping::SendAsync ( System address, int timeout, byte buffer, object userToken ) : void
Ping::SendAsync ( System address, int timeout, object userToken ) : void
Ping::SendAsync ( System address, object userToken ) : void
Ping::SendAsync ( string hostNameOrAddress, int timeout, byte buffer, System options, object userToken ) : void
Ping::SendAsync ( string hostNameOrAddress, int timeout, byte buffer, object userToken ) : void
Ping::SendAsync ( string hostNameOrAddress, int timeout, object userToken ) : void
Ping::SendAsync ( string hostNameOrAddress, object userToken ) : void

Usage Example

Example #1
2
        public static void ListAllHosts(byte[] ipBase, Action<AddressStruct> itemCallback)
        {
            for (int b4 = 0; b4 <= 255; b4++)
            {
                var ip = ipBase[0] + "." + ipBase[1] + "." + ipBase[2] + "." + b4;

                var ping = new Ping();
                ping.PingCompleted += (o, e) =>
                {
                    if (e.Error == null && e.Reply.Status == IPStatus.Success)
                        if (itemCallback != null)
                        {
                            GetMacAddress(
                                e.Reply.Address,
                                (mac) =>
                                {
                                    itemCallback(new AddressStruct()
                                    {
                                        IPAddress = e.Reply.Address,
                                        MacAddress = mac
                                    });
                                });
                        }
                };
                ping.SendAsync(ip, null);
            }
        }
All Usage Examples Of System.Net.NetworkInformation.Ping::SendAsync