Class MtuDiscovery
Allows to discover maximum size of Message Transfer Unit over IP network.
Inherited Members
Namespace: DotNext.Net.NetworkInformation
Assembly: DotNext.dll
Syntax
public class MtuDiscovery : Ping, IComponent, IDisposable
Remarks
The discovered MTU size doesn't include size of IPv4 or IPv6 headers.
Methods
| Improve this Doc View SourceDiscover(IPAddress, Int32, MtuDiscoveryOptions, CancellationToken)
Discovers maximum allowed MTU size by the underlying network.
Declaration
public int? Discover(IPAddress address, int timeout, MtuDiscoveryOptions options, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IPAddress | address | The destination host to which the MTU size should be discovered. |
Int32 | timeout | The maximum number of milliseconds to wait for the ICMP echo reply message. It's not a time-out of entire operation. |
MtuDiscoveryOptions | options | Discovery options. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Nullable<Int32> | The discovered MTU size, in bytes; or null if remote host is not reacheable. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
InvalidOperationException | Discovery is in progress. |
PingException | An exception was thrown while sending or receiving the ICMP messages. |
SocketException |
|
ObjectDisposedException | The object has been disposed. |
OperationCanceledException | The operation has been canceled. |
DiscoverAsync(IPAddress, Int32, MtuDiscoveryOptions, CancellationToken)
Discovers maximum allowed MTU size by the underlying network.
Declaration
public Task<int?> DiscoverAsync(IPAddress address, int timeout, MtuDiscoveryOptions options, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IPAddress | address | The destination host to which the MTU size should be discovered. |
Int32 | timeout | The maximum number of milliseconds to wait for the ICMP echo reply message. It's not a time-out of entire operation. |
MtuDiscoveryOptions | options | Discovery options. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Task<Nullable<Int32>> | The discovered MTU size, in bytes; or null if remote host is not reacheable. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
InvalidOperationException | Discovery is in progress. |
PingException | An exception was thrown while sending or receiving the ICMP messages. |
SocketException |
|
ObjectDisposedException | The object has been disposed. |
OperationCanceledException | The operation has been canceled. |