ホーム › NetworkManagement.IpHelper › MIB_TCPSTATS2
MIB_TCPSTATS2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| RtoAlgorithm | TCP_RTO_ALGORITHM | 4 | +0 | +0 | 再送タイムアウト値の算出に用いるアルゴリズム(TCP_RTO_ALGORITHM列挙)を示す。 | ||||||||||
| dwRtoMin | DWORD | 4 | +4 | +4 | 最小の RTO 値 (ミリ秒単位)。 | ||||||||||
| dwRtoMax | DWORD | 4 | +8 | +8 | 最大の RTO 値 (ミリ秒単位)。 | ||||||||||
| dwMaxConn | DWORD | 4 | +12 | +12 | 接続の最大数。このメンバーが -1 の場合、接続の最大数は可変です。 | ||||||||||
| dwActiveOpens | DWORD | 4 | +16 | +16 | アクティブオープンの数。アクティブオープンでは、クライアントがサーバーとの接続を開始します。 | ||||||||||
| dwPassiveOpens | DWORD | 4 | +20 | +20 | パッシブオープンの数。パッシブオープンでは、サーバーがクライアントからの接続要求を待ち受けます。 | ||||||||||
| dwAttemptFails | DWORD | 4 | +24 | +24 | 失敗した接続試行の数。 | ||||||||||
| dwEstabResets | DWORD | 4 | +28 | +28 | リセットされた確立済み接続の数。 | ||||||||||
| dwCurrEstab | DWORD | 4 | +32 | +32 | 現在確立されている接続の数。 | ||||||||||
| dw64InSegs | ULONGLONG | 8 | +40 | +40 | 受信したセグメントの数。 | ||||||||||
| dw64OutSegs | ULONGLONG | 8 | +48 | +48 | 送信したセグメントの数。この数には再送されたセグメントは含まれません。 | ||||||||||
| dwRetransSegs | DWORD | 4 | +56 | +56 | 再送されたセグメントの数。 | ||||||||||
| dwInErrs | DWORD | 4 | +60 | +60 | 受信したエラーの数。 | ||||||||||
| dwOutRsts | DWORD | 4 | +64 | +64 | リセットフラグを設定して送信されたセグメントの数。 | ||||||||||
| dwNumConns | DWORD | 4 | +68 | +68 | システムに現在存在する接続の数。この合計数には、リッスン中の接続を除くすべての状態の接続が含まれます。 - TCP_RTO_ALGORITHMType: DWORD 使用中の再送タイムアウト (RTO) アルゴリズム。
|
公式ドキュメント
MIB_TCPSTATS2 構造体は、ローカルコンピューター上で動作している TCP プロトコルの統計情報を格納します。この構造体は、32 ビットカウンターではなく 64 ビットカウンターを使用する点で MIB_TCPSTATS 構造体と異なります。
解説(Remarks)
GetTcpStatisticsEx2 関数は、MIB_TCPSTATS2 構造体へのポインターを返します。
この構造体は Iprtrmib.h ヘッダーファイルではなく、Tcpmib.h ヘッダーファイルで定義されています。Tcpmib.h ヘッダーファイルは Iprtrmib.h に自動的にインクルードされ、Iprtrmib.h は Iphlpapi.h ヘッダーファイルに自動的にインクルードされます。Tcpmib.h および Iprtrmib.h の各ヘッダーファイルを直接使用しないでください。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// MIB_TCPSTATS2 (x64 72 / x86 72 バイト)
typedef struct MIB_TCPSTATS2 {
TCP_RTO_ALGORITHM RtoAlgorithm;
DWORD dwRtoMin;
DWORD dwRtoMax;
DWORD dwMaxConn;
DWORD dwActiveOpens;
DWORD dwPassiveOpens;
DWORD dwAttemptFails;
DWORD dwEstabResets;
DWORD dwCurrEstab;
ULONGLONG dw64InSegs;
ULONGLONG dw64OutSegs;
DWORD dwRetransSegs;
DWORD dwInErrs;
DWORD dwOutRsts;
DWORD dwNumConns;
} MIB_TCPSTATS2;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MIB_TCPSTATS2
{
public int RtoAlgorithm;
public uint dwRtoMin;
public uint dwRtoMax;
public uint dwMaxConn;
public uint dwActiveOpens;
public uint dwPassiveOpens;
public uint dwAttemptFails;
public uint dwEstabResets;
public uint dwCurrEstab;
public ulong dw64InSegs;
public ulong dw64OutSegs;
public uint dwRetransSegs;
public uint dwInErrs;
public uint dwOutRsts;
public uint dwNumConns;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MIB_TCPSTATS2
Public RtoAlgorithm As Integer
Public dwRtoMin As UInteger
Public dwRtoMax As UInteger
Public dwMaxConn As UInteger
Public dwActiveOpens As UInteger
Public dwPassiveOpens As UInteger
Public dwAttemptFails As UInteger
Public dwEstabResets As UInteger
Public dwCurrEstab As UInteger
Public dw64InSegs As ULong
Public dw64OutSegs As ULong
Public dwRetransSegs As UInteger
Public dwInErrs As UInteger
Public dwOutRsts As UInteger
Public dwNumConns As UInteger
End Structureimport ctypes
from ctypes import wintypes
class MIB_TCPSTATS2(ctypes.Structure):
_fields_ = [
("RtoAlgorithm", ctypes.c_int),
("dwRtoMin", wintypes.DWORD),
("dwRtoMax", wintypes.DWORD),
("dwMaxConn", wintypes.DWORD),
("dwActiveOpens", wintypes.DWORD),
("dwPassiveOpens", wintypes.DWORD),
("dwAttemptFails", wintypes.DWORD),
("dwEstabResets", wintypes.DWORD),
("dwCurrEstab", wintypes.DWORD),
("dw64InSegs", ctypes.c_ulonglong),
("dw64OutSegs", ctypes.c_ulonglong),
("dwRetransSegs", wintypes.DWORD),
("dwInErrs", wintypes.DWORD),
("dwOutRsts", wintypes.DWORD),
("dwNumConns", wintypes.DWORD),
]#[repr(C)]
pub struct MIB_TCPSTATS2 {
pub RtoAlgorithm: i32,
pub dwRtoMin: u32,
pub dwRtoMax: u32,
pub dwMaxConn: u32,
pub dwActiveOpens: u32,
pub dwPassiveOpens: u32,
pub dwAttemptFails: u32,
pub dwEstabResets: u32,
pub dwCurrEstab: u32,
pub dw64InSegs: u64,
pub dw64OutSegs: u64,
pub dwRetransSegs: u32,
pub dwInErrs: u32,
pub dwOutRsts: u32,
pub dwNumConns: u32,
}import "golang.org/x/sys/windows"
type MIB_TCPSTATS2 struct {
RtoAlgorithm int32
dwRtoMin uint32
dwRtoMax uint32
dwMaxConn uint32
dwActiveOpens uint32
dwPassiveOpens uint32
dwAttemptFails uint32
dwEstabResets uint32
dwCurrEstab uint32
dw64InSegs uint64
dw64OutSegs uint64
dwRetransSegs uint32
dwInErrs uint32
dwOutRsts uint32
dwNumConns uint32
}type
MIB_TCPSTATS2 = record
RtoAlgorithm: Integer;
dwRtoMin: DWORD;
dwRtoMax: DWORD;
dwMaxConn: DWORD;
dwActiveOpens: DWORD;
dwPassiveOpens: DWORD;
dwAttemptFails: DWORD;
dwEstabResets: DWORD;
dwCurrEstab: DWORD;
dw64InSegs: UInt64;
dw64OutSegs: UInt64;
dwRetransSegs: DWORD;
dwInErrs: DWORD;
dwOutRsts: DWORD;
dwNumConns: DWORD;
end;const MIB_TCPSTATS2 = extern struct {
RtoAlgorithm: i32,
dwRtoMin: u32,
dwRtoMax: u32,
dwMaxConn: u32,
dwActiveOpens: u32,
dwPassiveOpens: u32,
dwAttemptFails: u32,
dwEstabResets: u32,
dwCurrEstab: u32,
dw64InSegs: u64,
dw64OutSegs: u64,
dwRetransSegs: u32,
dwInErrs: u32,
dwOutRsts: u32,
dwNumConns: u32,
};type
MIB_TCPSTATS2 {.bycopy.} = object
RtoAlgorithm: int32
dwRtoMin: uint32
dwRtoMax: uint32
dwMaxConn: uint32
dwActiveOpens: uint32
dwPassiveOpens: uint32
dwAttemptFails: uint32
dwEstabResets: uint32
dwCurrEstab: uint32
dw64InSegs: uint64
dw64OutSegs: uint64
dwRetransSegs: uint32
dwInErrs: uint32
dwOutRsts: uint32
dwNumConns: uint32struct MIB_TCPSTATS2
{
int RtoAlgorithm;
uint dwRtoMin;
uint dwRtoMax;
uint dwMaxConn;
uint dwActiveOpens;
uint dwPassiveOpens;
uint dwAttemptFails;
uint dwEstabResets;
uint dwCurrEstab;
ulong dw64InSegs;
ulong dw64OutSegs;
uint dwRetransSegs;
uint dwInErrs;
uint dwOutRsts;
uint dwNumConns;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MIB_TCPSTATS2 サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; RtoAlgorithm : TCP_RTO_ALGORITHM (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwRtoMin : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwRtoMax : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwMaxConn : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwActiveOpens : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwPassiveOpens : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwAttemptFails : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwEstabResets : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwCurrEstab : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; dw64InSegs : ULONGLONG (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; dw64OutSegs : ULONGLONG (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; dwRetransSegs : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; dwInErrs : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; dwOutRsts : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; dwNumConns : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MIB_TCPSTATS2
#field int RtoAlgorithm
#field int dwRtoMin
#field int dwRtoMax
#field int dwMaxConn
#field int dwActiveOpens
#field int dwPassiveOpens
#field int dwAttemptFails
#field int dwEstabResets
#field int dwCurrEstab
#field int64 dw64InSegs
#field int64 dw64OutSegs
#field int dwRetransSegs
#field int dwInErrs
#field int dwOutRsts
#field int dwNumConns
#endstruct
stdim st, MIB_TCPSTATS2 ; NSTRUCT 変数を確保
st->RtoAlgorithm = 100
mes "RtoAlgorithm=" + st->RtoAlgorithm