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.
Constructors
View SourceMtuDiscovery()
Declaration
public MtuDiscovery()
Methods
View SourceDiscover(IPAddress, int, MtuDiscoveryOptions, CancellationToken)
Discovers maximum allowed MTU size by the underlying network.
Declaration
public int? Discover(IPAddress address, int timeout, MtuDiscoveryOptions options, CancellationToken token = default)
Parameters
| Type | Name | Description |
|---|---|---|
| IPAddress | address | The destination host to which the MTU size should be discovered. |
| int | 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 |
|---|---|
| int? | The discovered MTU size, in bytes; or null if remote host is not reachable. |
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, int, 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)
Parameters
| Type | Name | Description |
|---|---|---|
| IPAddress | address | The destination host to which the MTU size should be discovered. |
| int | 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<int?> | The discovered MTU size, in bytes; or null if remote host is not reachable. |
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. |