Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 781495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:14:18+00:00 2026-05-14T20:14:18+00:00

I’m working on pseudo-transport layer software that runs over UDP, providing reliable connection-oriented transmission,

  • 0

I’m working on pseudo-transport layer software that runs over UDP, providing reliable connection-oriented transmission, as an alternative to TCP. In order to maximize network efficiency, we query the MTU of the “best” network adapter upon initialization.

MIB_IFROW row = {0};
row.dwIndex = dwBestIfIndex;

dwRes = GetIfEntry(&row);

Searching online I found that you can use the following netsh commands to query for this same value, from a command prompt (not a C++ API)

netsh interface ipv4 show interfaces
netsh interface ipv4 show subinterfaces

The troubling issue is that while row.dwMtu may be set to 1500, snooping the network traffic on the sending laptop shows that our packets are fragmented into 1300 byte packets.
netsh also reports that the MTU is 1300.

Clearly the value reported by netsh command is the actual used values. Anyone know what API I can call to get the same values as netsh?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:14:19+00:00Added an answer on May 14, 2026 at 8:14 pm

    There are local MTU size and Path MTU (see RFC 1191). You can use commands like

    ping -f -l 1464 www.stackoverflow.com
    ping -f -l 1465 www.stackoverflow.com
    

    to determine a Path MTU. Take in consideration the header size of ICMP packages and IP headers. See Path MTU Discovery for API solution.

    UPDATED: Please no more such questions! It was very interesting for me to find the answer and I spend some hours for this. But… I found! To receive correct value of MTU size you should use GetIpInterfaceTable API which returns PMIB_IPINTERFACE_TABLE structure which has array of MIB_IPINTERFACE_ROW structures. MIB_IPINTERFACE_ROW hat InterfaceIndex which helps you to identify IP interface, it is the same as in other well known IP Helper functions. You can also use ConvertInterfaceLuidToNameW function to receive from another field InterfaceLuid the interface name.

    But the most interesting thing is NlMtu field

    typedef struct _MIB_IPINTERFACE_ROW {
        ADDRESS_FAMILY Family;
        NET_LUID InterfaceLuid;
        NET_IFINDEX InterfaceIndex;
        // ...
        ULONG NlMtu;
        // ...
    };
    

    In the documentation (see http://msdn.microsoft.com/en-us/library/aa814496(v=VS.85).aspx) it is described as “The network layer MTU size, in bytes.“. The same text and no more you will find also in Windows Driver Kit documentation (see http://msdn.microsoft.com/en-us/library/ff559254(VS.85).aspx). This field NlMtu is what you are searching for. My computer for example is connected to the Internet through a DSL router and NlMtu is not 1500 like it would be without the router, but has the correct value 1492 instead. In your case it must be 1300.

    If you have one of the last versions of Microsoft SDK installed, then you will find in C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\netds\iphelp\Netinfo directory an example which use GetIpInterfaceTable API. Just set a brakepoint on the line about 270 in the netinfo.c file and you will see in InterfaceTable->Table[i].NlMtu the correct value of IP MTU of the corresponding interface adapter. If you verify in registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\Interfaces{34407201-997C-41FF-9EBF-1B7D6DF92B38} which value has MTU REG_DWORD for your Interfaces card ({34407201-997C-41FF-9EBF-1B7D6DF92B38} in my case) it must be the same value.

    The function GetIpInterfaceTable exists starting with Vista, but how you can see from the name PMIB_IPINTERFACE_TABLE the values come from MIB information of TCP adapter see (Windows DDK). Some years ago it was no IP helper DLL at all and to receive the information which displays IpConfig.exe one has to use CreateFile and DeviceIoControl to give such informations from TCP TDI driver (see constants like L”\Device\Tcp” and IOCTL_TCP_QUERY_INFORMATION_EX in tcpioctl.h). So perhaps it is possible to give the same information on Windows XP, but it is not important.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.