Retrieving Statistics for TCP and UDP
A version of this page is also available for
4/8/2010
IP Helper makes it possible to access information about network protocols that are used on the local computer. Use the functions described following to retrieve information about the Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) on the local computer.
The GetTcpStatistics function retrieves the current statistics for TCP. Similarly, the GetUdpStatistics function retrieves the current statistics for UDP.
The GetTcpTable function retrieves the TCP connection table. The GetUdpTable retrieves the UDP listener table.
The SetTcpEntry function enables a developer to set the state of a specified TCP connection to MIB_TCP_STATE_DELETE_TCB.
The following table describes each GetTcpStatistics variable and MIB_TCPSTATS member.
Value | Description |
---|---|
pStats |
Pointer to a MIB_TCPSTATS structure that, on successful return, contains the TCP statistics for the local computer. |
MIB_TCPSTATS (All fields are read-only, and cannot be changed by the API user) |
dwRtoAlgorithm Specifies the retransmission time-out algorithm in use. This member can be one of the following values: MIB_TCP_RTO_CONSTANT: Constant Time-out MIB_TCP_RTO_RSRE MIL-STD-1778: Appendix B MIB_TCP_RTO_VANJ: Van Jacobson's Algorithm MIB_TCP_RTO_OTHER: Other dwRtoMin Specifies the minimum retransmission time-out value in milliseconds. dwRtoMax Specifies the maximum retransmission time-out value in milliseconds. dwMaxConn Specifies the maximum number of connections. If this member is -1, the maximum number of connections is dynamic. dwActiveOpens Specifies the number of active opens. In an active open, the client is initiating a connection with the server. dwPassiveOpens Specifies the number of passive opens. In a passive open, the server is listening for a connection request from a client. dwAttemptFails Specifies the number of failed connection attempts. dwEstabResets Specifies the number of established connections that have been reset. dwCurrEstab Specifies the number of currently established connections. dwInSegs Specifies the number of segments received or transmitted. dwOutSegs Specifies the number of segments transmitted. This number does not include retransmitted segments. dwRetransSegs Specifies the number of segments retransmitted. dwInErrs Specifies the number of errors received. dwOutRsts Specifies the number of segments transmitted with the reset flag set. dwNumConns Specifies the cumulative number of connections. |
The following table describes each GetUdpStatistics variable and MIB_UDPSTATS member.
Value | Description |
---|---|
pStats |
Pointer to a MIB_UDPSTATS structure that, on successful return, contains the UDP statistics for the local computer. |
MIB_UDPSTATS (All fields are read-only, and cannot be changed by the API user) |
dwInDatagrams Specifies the number of datagrams received. dwNoPorts Specifies the number of received datagrams that were discarded because the port specified was invalid. dwInErrors Specifies the number of erroneous datagrams that were received. This number does not include the value contained by the dwNoPorts member. dwOutDatagrams Specifies the number of datagrams transmitted. dwNumAddrs Specifies the number of entries in the UDP listener table. |
The following table describes each GetTcpTable variable and MIB_TCPTABLE member.
Value | Description |
---|---|
pTcpTable |
Pointer to a buffer that, on successful return, contains the TCP connection table as a MIB_TCPTABLE structure. |
pdwSize |
Specifies the size of the buffer pointed to by the pTcpTable parameter. If the buffer is not large enough to hold the returned connection table, the function sets this parameter equal to the required buffer size. |
bOrder |
Specifies whether the connection table should be sorted. If this parameter is TRUE, the table is sorted in order of:
|
MIB_TCPTABLE |
dwNumEntries Specifies the number of entries in the table. table[ANY_SIZE] Pointer to a table of TCP connections implemented as an array of MIB_TCPTABLE structures. |
MIB_TCPROW (All fields are read-write, and can be changed by the API user with SetTcpEntry) |
dwState Specifies the state of the TCP connection. dwLocalAddr Specifies the address for the connection on the local computer. dwLocalPort Specifies the port number for the connection on the local computer. dwRemoteAddr Specifies the address for the connection on the remote computer. dwRemotePort Specifies the port number the connection on the remote computer. |
The following table describes each GetUdpTable variable and MIB_UDPTABLE member.
Value | Description |
---|---|
pUdpTable |
Pointer to a buffer that, on successful return, contains the UDP listener table as a MIB_UDPTABLE structure. |
pdwSize |
Specifies the size of the buffer pointed to by the pUdpTable parameter. If the buffer is not large enough to hold the returned listener table, the function sets this parameter equal to the required buffer size. |
bOrder |
Specifies whether the returned table should be sorted. If this parameter is TRUE, the table is sorted in order of:
|
MIB_UDPTABLE (All fields are read-only, and cannot be changed by the API user) |
dwNumEntries Specifies the number of entries in the table. table[ANY_SIZE] Pointer to an array of MIB_UDPROW structures. |
MIB_UDPTABLE (All fields are read-only, and cannot be changed by the API user) |
dwLocalAddr Specifies the IP address on the local computer. dwLocalPort Specifies the port number on the local computer. |
The following table describes each SetTcpEntry variable.
Value | Description |
---|---|
pTcpRow |
Pointer to a MIB_TCPROW structure (See the GetTcpTable description above). This structure contains information to identify the TCP connection to modify. It also specifies the new state for the TCP connection. The caller must specify values for all the members in this structure. |