Вопрос

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?

Это было полезно?

Решение

Taken from here:

winsock doesn't support reporting the discovered MTU, even though other TCP/IP stacks do (e.g. AIX through a socket option IP_GETPMTU). As winsock cannot report that, .NET can't provide an API (which would have to be on top of winsock).

Другие советы

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.

Have you tried using libpcap with C#? There is a library called SharpPCap that you can use to find the PMTU.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top