ホーム › Networking.WinSock › TCP_INFO_v0
TCP_INFO_v0
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| State | TCPSTATE | 4 | +0 | +0 | TCP 接続の状態を示す TCPSTATE 列挙型の値です。 |
| Mss | DWORD | 4 | +4 | +4 | 接続の現在の最大セグメントサイズ (MSS) をバイト単位で表します。 |
| ConnectionTimeMs | ULONGLONG | 8 | +8 | +8 | 接続の継続時間 (ミリ秒単位) です。 |
| TimestampsEnabled | BOOLEAN | 1 | +16 | +16 | 接続で TCP タイムスタンプが有効な場合は TRUE、それ以外の場合は FALSE です。 |
| RttUs | DWORD | 4 | +20 | +20 | 接続の現在の推定ラウンドトリップ時間 (マイクロ秒単位) です。 |
| MinRttUs | DWORD | 4 | +24 | +24 | サンプリングされたラウンドトリップ時間の最小値 (マイクロ秒単位) です。 |
| BytesInFlight | DWORD | 4 | +28 | +28 | 送信済みで確認応答されていないバイト数の現在値です。 |
| Cwnd | DWORD | 4 | +32 | +32 | 現在の輻輳ウィンドウのサイズ (バイト単位) です。 |
| SndWnd | DWORD | 4 | +36 | +36 | 送信ウィンドウ (RFC 793 の SND.WND) のサイズ (バイト単位) です。 |
| RcvWnd | DWORD | 4 | +40 | +40 | 受信ウィンドウ (RFC 793 の RCV.WND) のサイズ (バイト単位) です。 |
| RcvBuf | DWORD | 4 | +44 | +44 | 現在の受信バッファーのサイズ (バイト単位) です。受信ウィンドウの自動チューニングが有効な場合、受信バッファーのサイズは動的に変化します。 |
| BytesOut | ULONGLONG | 8 | +48 | +48 | 送信された合計バイト数です。 |
| BytesIn | ULONGLONG | 8 | +56 | +56 | 受信した合計バイト数です。 |
| BytesReordered | DWORD | 4 | +64 | +64 | 順序が入れ替わった合計バイト数です。 |
| BytesRetrans | DWORD | 4 | +68 | +68 | 再送信された合計バイト数です。 |
| FastRetrans | DWORD | 4 | +72 | +72 | Fast Retransmit アルゴリズムが呼び出された回数です。 |
| DupAcksIn | DWORD | 4 | +76 | +76 | 受信した重複確認応答の合計数です。 |
| TimeoutEpisodes | DWORD | 4 | +80 | +80 | 再送タイムアウトエピソードの合計数です。各エピソードは複数のタイムアウトで構成される場合があります。 |
| SynRetrans | BYTE | 1 | +84 | +84 | 再送信された同期制御フラグ (SYN) の合計数です。 |
公式ドキュメント
ソケットに対して収集された伝送制御プロトコル (TCP) の統計情報を格納します。
解説(Remarks)
この構造体のインスタンスを取得するには、 WSAIoctl 関数または LPWSPIoctl 関数を SIO_TCP_INFO 制御コードとともに呼び出します。この構造体の v0 バージョンを取得するには、lpvInBuffer フィールドに 0 を指定します。
出典・ライセンス: 上記「公式ドキュメント」の内容は 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>
// TCP_INFO_v0 (x64 88 / x86 88 バイト)
typedef struct TCP_INFO_v0 {
TCPSTATE State;
DWORD Mss;
ULONGLONG ConnectionTimeMs;
BOOLEAN TimestampsEnabled;
DWORD RttUs;
DWORD MinRttUs;
DWORD BytesInFlight;
DWORD Cwnd;
DWORD SndWnd;
DWORD RcvWnd;
DWORD RcvBuf;
ULONGLONG BytesOut;
ULONGLONG BytesIn;
DWORD BytesReordered;
DWORD BytesRetrans;
DWORD FastRetrans;
DWORD DupAcksIn;
DWORD TimeoutEpisodes;
BYTE SynRetrans;
} TCP_INFO_v0;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TCP_INFO_v0
{
public int State;
public uint Mss;
public ulong ConnectionTimeMs;
[MarshalAs(UnmanagedType.U1)] public bool TimestampsEnabled;
public uint RttUs;
public uint MinRttUs;
public uint BytesInFlight;
public uint Cwnd;
public uint SndWnd;
public uint RcvWnd;
public uint RcvBuf;
public ulong BytesOut;
public ulong BytesIn;
public uint BytesReordered;
public uint BytesRetrans;
public uint FastRetrans;
public uint DupAcksIn;
public uint TimeoutEpisodes;
public byte SynRetrans;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TCP_INFO_v0
Public State As Integer
Public Mss As UInteger
Public ConnectionTimeMs As ULong
<MarshalAs(UnmanagedType.U1)> Public TimestampsEnabled As Boolean
Public RttUs As UInteger
Public MinRttUs As UInteger
Public BytesInFlight As UInteger
Public Cwnd As UInteger
Public SndWnd As UInteger
Public RcvWnd As UInteger
Public RcvBuf As UInteger
Public BytesOut As ULong
Public BytesIn As ULong
Public BytesReordered As UInteger
Public BytesRetrans As UInteger
Public FastRetrans As UInteger
Public DupAcksIn As UInteger
Public TimeoutEpisodes As UInteger
Public SynRetrans As Byte
End Structureimport ctypes
from ctypes import wintypes
class TCP_INFO_v0(ctypes.Structure):
_fields_ = [
("State", ctypes.c_int),
("Mss", wintypes.DWORD),
("ConnectionTimeMs", ctypes.c_ulonglong),
("TimestampsEnabled", ctypes.c_byte),
("RttUs", wintypes.DWORD),
("MinRttUs", wintypes.DWORD),
("BytesInFlight", wintypes.DWORD),
("Cwnd", wintypes.DWORD),
("SndWnd", wintypes.DWORD),
("RcvWnd", wintypes.DWORD),
("RcvBuf", wintypes.DWORD),
("BytesOut", ctypes.c_ulonglong),
("BytesIn", ctypes.c_ulonglong),
("BytesReordered", wintypes.DWORD),
("BytesRetrans", wintypes.DWORD),
("FastRetrans", wintypes.DWORD),
("DupAcksIn", wintypes.DWORD),
("TimeoutEpisodes", wintypes.DWORD),
("SynRetrans", ctypes.c_ubyte),
]#[repr(C)]
pub struct TCP_INFO_v0 {
pub State: i32,
pub Mss: u32,
pub ConnectionTimeMs: u64,
pub TimestampsEnabled: u8,
pub RttUs: u32,
pub MinRttUs: u32,
pub BytesInFlight: u32,
pub Cwnd: u32,
pub SndWnd: u32,
pub RcvWnd: u32,
pub RcvBuf: u32,
pub BytesOut: u64,
pub BytesIn: u64,
pub BytesReordered: u32,
pub BytesRetrans: u32,
pub FastRetrans: u32,
pub DupAcksIn: u32,
pub TimeoutEpisodes: u32,
pub SynRetrans: u8,
}import "golang.org/x/sys/windows"
type TCP_INFO_v0 struct {
State int32
Mss uint32
ConnectionTimeMs uint64
TimestampsEnabled byte
RttUs uint32
MinRttUs uint32
BytesInFlight uint32
Cwnd uint32
SndWnd uint32
RcvWnd uint32
RcvBuf uint32
BytesOut uint64
BytesIn uint64
BytesReordered uint32
BytesRetrans uint32
FastRetrans uint32
DupAcksIn uint32
TimeoutEpisodes uint32
SynRetrans byte
}type
TCP_INFO_v0 = record
State: Integer;
Mss: DWORD;
ConnectionTimeMs: UInt64;
TimestampsEnabled: ByteBool;
RttUs: DWORD;
MinRttUs: DWORD;
BytesInFlight: DWORD;
Cwnd: DWORD;
SndWnd: DWORD;
RcvWnd: DWORD;
RcvBuf: DWORD;
BytesOut: UInt64;
BytesIn: UInt64;
BytesReordered: DWORD;
BytesRetrans: DWORD;
FastRetrans: DWORD;
DupAcksIn: DWORD;
TimeoutEpisodes: DWORD;
SynRetrans: Byte;
end;const TCP_INFO_v0 = extern struct {
State: i32,
Mss: u32,
ConnectionTimeMs: u64,
TimestampsEnabled: u8,
RttUs: u32,
MinRttUs: u32,
BytesInFlight: u32,
Cwnd: u32,
SndWnd: u32,
RcvWnd: u32,
RcvBuf: u32,
BytesOut: u64,
BytesIn: u64,
BytesReordered: u32,
BytesRetrans: u32,
FastRetrans: u32,
DupAcksIn: u32,
TimeoutEpisodes: u32,
SynRetrans: u8,
};type
TCP_INFO_v0 {.bycopy.} = object
State: int32
Mss: uint32
ConnectionTimeMs: uint64
TimestampsEnabled: uint8
RttUs: uint32
MinRttUs: uint32
BytesInFlight: uint32
Cwnd: uint32
SndWnd: uint32
RcvWnd: uint32
RcvBuf: uint32
BytesOut: uint64
BytesIn: uint64
BytesReordered: uint32
BytesRetrans: uint32
FastRetrans: uint32
DupAcksIn: uint32
TimeoutEpisodes: uint32
SynRetrans: uint8struct TCP_INFO_v0
{
int State;
uint Mss;
ulong ConnectionTimeMs;
ubyte TimestampsEnabled;
uint RttUs;
uint MinRttUs;
uint BytesInFlight;
uint Cwnd;
uint SndWnd;
uint RcvWnd;
uint RcvBuf;
ulong BytesOut;
ulong BytesIn;
uint BytesReordered;
uint BytesRetrans;
uint FastRetrans;
uint DupAcksIn;
uint TimeoutEpisodes;
ubyte SynRetrans;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TCP_INFO_v0 サイズ: 88 バイト(x64)
dim st, 22 ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; State : TCPSTATE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Mss : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ConnectionTimeMs : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; TimestampsEnabled : BOOLEAN (+16, 1byte) poke st,16,値 / 値 = peek(st,16)
; RttUs : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; MinRttUs : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; BytesInFlight : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; Cwnd : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; SndWnd : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; RcvWnd : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; RcvBuf : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; BytesOut : ULONGLONG (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; BytesIn : ULONGLONG (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; BytesReordered : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; BytesRetrans : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; FastRetrans : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; DupAcksIn : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; TimeoutEpisodes : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; SynRetrans : BYTE (+84, 1byte) poke st,84,値 / 値 = peek(st,84)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global TCP_INFO_v0
#field int State
#field int Mss
#field int64 ConnectionTimeMs
#field bool1 TimestampsEnabled
#field int RttUs
#field int MinRttUs
#field int BytesInFlight
#field int Cwnd
#field int SndWnd
#field int RcvWnd
#field int RcvBuf
#field int64 BytesOut
#field int64 BytesIn
#field int BytesReordered
#field int BytesRetrans
#field int FastRetrans
#field int DupAcksIn
#field int TimeoutEpisodes
#field byte SynRetrans
#endstruct
stdim st, TCP_INFO_v0 ; NSTRUCT 変数を確保
st->State = 100
mes "State=" + st->State