How do I find the path MTU between connection? I need this to define the packet size of my UDP connection. Is there things like Path MTU Discovery in .Net?
Asked
Active
Viewed 2,007 times
3 Answers
2
i have found a way(workaround) to find the path mtu for udp on c#. just try send udp packet with udpclient.dontfragment set to true. if it throws an exception, reduce the packet size until no exception is thrown. if anybody would like to see some sample, just ask.

Syaiful Nizam Yahya
- 4,196
- 11
- 51
- 71
-
1The lower MTU may be along the path. So you don't get exception, the packet is sent, but not received. You have to send some packet sizes and make other end point to sent you some ACK packets back to do MTU discovery. – xmedeko Oct 18 '18 at 07:22
-
1"Any device along the path whose MTU is smaller than the packet will drop such packets and send back an ICMP "Destination Unreachable (Datagram Too Big)" message containing its MTU." https://en.wikipedia.org/wiki/Maximum_transmission_unit#Path_MTU_Discovery – aminhotob Oct 30 '18 at 14:33
1
Have you tried using libpcap with C#? There is a library called SharpPCap that you can use to find the PMTU.

eldarerathis
- 35,455
- 10
- 90
- 93

isyi
- 1,282
- 1
- 11
- 11
-
Also, can I get your sample code for using Udpclient to find the Path MTU without libpcap? – isyi Feb 06 '12 at 22:37