none
GetExtendedTcpTable (iphlpapi.dll) returns undocumented error code -1073741823 RRS feed

  • Question

  • I try to retrieve windows tcp table while tcp connections are intensively established in parallel.

    In code example below (#1) one task is establishing many tcp connections and not releasing them, eventually leading to SocketException, and the other is reading tcp table with iphlpapi in parallel. When SocketException in first task occurs, all previous connections are released and same cycle repeats.

    So, on my machine tcp table is read well and no exceptions are thrown. But on other set of machines same code makes GetExtendedTcpTable return undocumented error code -1073741823, making code throw on line 98.

    What is this error code and why does it occur only at specific machines?

    The issue is not googling well. I found only one related issue raised (#2) and there are no comments explaining such error code origin.

    Also form is not allowing me use links, so here are references.

    #1 https://github.com/paatrofimov/tcp-table-error-demo/blob/master/Program.cs

    #2 https://github.com/giampaolo/psutil/issues/1294

    Tuesday, October 8, 2019 1:43 PM

Answers

  • -1073741823 = 0xC0000001 = STATUS_UNSUCCESSFUL
    the linked code should use  Marshal.GetLastWin32Error to get the error code
    • Marked as answer by pavel trofimov Wednesday, October 9, 2019 6:20 AM
    Tuesday, October 8, 2019 5:12 PM

All replies

  • -1073741823 = 0xC0000001 = STATUS_UNSUCCESSFUL
    the linked code should use  Marshal.GetLastWin32Error to get the error code
    • Marked as answer by pavel trofimov Wednesday, October 9, 2019 6:20 AM
    Tuesday, October 8, 2019 5:12 PM
  • I've tried that and the result is more confusing than helpful - 317. According to its description it is related to messages formatting, which is not really what I'm doing.

    Though, I was given a tip to look at msdn below and found out that -1073741823 appears when system is under high load. So this actually answers my question.

    https://docs.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-gettcptable

    Wednesday, October 9, 2019 6:20 AM