![]() | Pinger Class |
Namespace: Neon.Net
The Pinger type exposes the following members.
Name | Description | |
---|---|---|
![]() | Clear |
Disposes any unused underlying Ping instances.
|
![]() | Dispose |
Releases all resources associated with the instance.
|
![]() | Dispose(Boolean) |
Releases all associated resources.
|
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Finalize |
Finalizer.
(Overrides ObjectFinalize.) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | SendPingAsync(IPAddress, Int32) |
Pings a IP address.
|
![]() | SendPingAsync(String, Int32) |
Pings a IP address passed as a string.
|
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Unfortunately, the .NET Framework Ping class is not threadsafe (even the async methods). So, we need to ensure that only one ping request is performed on any given instance.
My original idea was to simply create and dispose Ping] instances on the fly for each request, but I changed my mind after thinking about the potential performance overhead as well as the potential for exhausting ephemeral socket ports.
Instead, I'm going to maintain a queue of Ping instances that that can be reused for subsequent queries.