question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`IpHlpApi.GetExtendedUdpTable<IpHlpApi.MIB_UDP6TABLE_OWNER_PID>` Bug?

See original GitHub issue

Describe the bug I got a lot of large PID from UDP6 table.

It seems like a bug.

If I change to UDP table (IPv4) rather 6, and change AF_INET6 to AF_INET. There’s no any large PID, all in 5 digits.

image

What code is involved

static void PrintUdpV6() {
    using var table = IpHlpApi.GetExtendedUdpTable<IpHlpApi.MIB_UDP6TABLE_OWNER_PID>(IpHlpApi.UDP_TABLE_CLASS.UDP_TABLE_OWNER_PID,
                                                                                     Ws2_32.ADDRESS_FAMILY.AF_INET6);

    foreach (var row in table) {
        Console.WriteLine($"PID={row.dwOwningPid, 10}, EndPoint={new IPEndPoint(new IPAddress(row.ucLocalAddr), (ushort)IPAddress.NetworkToHostOrder((short)row.dwLocalPort))}");
    }
}

Expected behavior No large PID.

Screenshots If applicable, add screenshots to help explain your problem.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
dahallcommented, May 4, 2022

I went through every structure to ensure size is correct. Most recent commit has all those corrections.

0reactions
GF-Huangcommented, May 4, 2022

Thanks your great work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

GetExtendedTcpTable function (iphlpapi.h) - Win32 apps
The GetExtendedTcpTable function retrieves a table that contains a list of TCP endpoints available to the application.
Read more >
GetExtendedTcpTable (iphlpapi.dll) returns undocumented ...
What is this error code and why does it occur only at specific machines? The issue is not googling well. I found only...
Read more >
net_windows.go
modiphlpapi = windows.NewLazySystemDLL("iphlpapi.dll"). procGetExtendedTCPTable = modiphlpapi.NewProc("GetExtendedTcpTable").
Read more >
gopsutil/net/net_windows.go at master
NewLazySystemDLL("iphlpapi.dll") procGetExtendedTCPTable = modiphlpapi.NewProc("GetExtendedTcpTable") procGetExtendedUDPTable = modiphlpapi.
Read more >
GetExtendedTcpTable (iphlpapi): pinvoke.net
The GetExtendedTcpTable function retrieves a table that contains a list of TCP endpoints available to the application. C# Signature: [DllImport("iphlpapi.dll", ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found