ホーム › Networking.WinSock › TCP_INFO_v2
TCP_INFO_v2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| State | TCPSTATE | 4 | +0 | +0 | TCP接続の状態を示すTCPSTATE列挙値。CLOSEDやESTABLISHED等を表す。 |
| Mss | DWORD | 4 | +4 | +4 | この接続で使用中の最大セグメントサイズをバイト単位で示す。 |
| ConnectionTimeMs | ULONGLONG | 8 | +8 | +8 | 接続確立からの経過時間をミリ秒単位で示す。 |
| TimestampsEnabled | BOOLEAN | 1 | +16 | +16 | TCPタイムスタンプオプションが有効かを示す真偽値。TRUEで有効。 |
| RttUs | DWORD | 4 | +20 | +20 | 現在の往復遅延時間(RTT)をマイクロ秒単位で示す。 |
| MinRttUs | DWORD | 4 | +24 | +24 | 観測された最小往復遅延時間をマイクロ秒単位で示す。 |
| BytesInFlight | DWORD | 4 | +28 | +28 | 未確認(在飛行中)の送信済みバイト数を示す。 |
| Cwnd | DWORD | 4 | +32 | +32 | 現在の輻輳ウィンドウサイズをバイト単位で示す。 |
| SndWnd | DWORD | 4 | +36 | +36 | 送信ウィンドウサイズをバイト単位で示す。 |
| RcvWnd | DWORD | 4 | +40 | +40 | 受信ウィンドウサイズをバイト単位で示す。 |
| 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 | 高速再送が発生した回数を示す。 |
| DupAcksIn | DWORD | 4 | +76 | +76 | 受信した重複ACKの数を示す。 |
| TimeoutEpisodes | DWORD | 4 | +80 | +80 | 再送タイムアウトが発生したエピソード数を示す。 |
| SynRetrans | BYTE | 1 | +84 | +84 | SYNセグメントの再送回数を示す。 |
| SndLimTransRwin | DWORD | 4 | +88 | +88 | 受信ウィンドウにより送信が制限された遷移回数を示す。 |
| SndLimTimeRwin | DWORD | 4 | +92 | +92 | 受信ウィンドウにより送信が制限された累積時間を示す。 |
| SndLimBytesRwin | ULONGLONG | 8 | +96 | +96 | 受信ウィンドウにより送信が制限された期間のバイト数を示す。 |
| SndLimTransCwnd | DWORD | 4 | +104 | +104 | 輻輳ウィンドウにより送信が制限された遷移回数を示す。 |
| SndLimTimeCwnd | DWORD | 4 | +108 | +108 | 輻輳ウィンドウにより送信が制限された累積時間を示す。 |
| SndLimBytesCwnd | ULONGLONG | 8 | +112 | +112 | 輻輳ウィンドウにより送信が制限された期間のバイト数を示す。 |
| SndLimTransSnd | DWORD | 4 | +120 | +120 | 送信側アプリのデータ供給不足で送信が制限された遷移回数を示す。 |
| SndLimTimeSnd | DWORD | 4 | +124 | +124 | 送信側アプリのデータ供給不足で送信が制限された累積時間を示す。 |
| SndLimBytesSnd | ULONGLONG | 8 | +128 | +128 | 送信側アプリのデータ供給不足で制限された期間のバイト数を示す。 |
| OutOfOrderPktsIn | DWORD | 4 | +136 | +136 | 順序外で受信したパケット数を示す。 |
| EcnNegotiated | BOOLEAN | 1 | +140 | +140 | ECN(明示的輻輳通知)が接続で合意されたかを示す真偽値。 |
| EceAcksIn | DWORD | 4 | +144 | +144 | ECEフラグ付きで受信したACK数を示す。輻輳経験の通知を表す。 |
| PtoEpisodes | DWORD | 4 | +148 | +148 | PTO(プローブタイムアウト)が発生したエピソード数を示す。 |
各言語での定義
#include <windows.h>
// TCP_INFO_v2 (x64 152 / x86 152 バイト)
typedef struct TCP_INFO_v2 {
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;
DWORD SndLimTransRwin;
DWORD SndLimTimeRwin;
ULONGLONG SndLimBytesRwin;
DWORD SndLimTransCwnd;
DWORD SndLimTimeCwnd;
ULONGLONG SndLimBytesCwnd;
DWORD SndLimTransSnd;
DWORD SndLimTimeSnd;
ULONGLONG SndLimBytesSnd;
DWORD OutOfOrderPktsIn;
BOOLEAN EcnNegotiated;
DWORD EceAcksIn;
DWORD PtoEpisodes;
} TCP_INFO_v2;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TCP_INFO_v2
{
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;
public uint SndLimTransRwin;
public uint SndLimTimeRwin;
public ulong SndLimBytesRwin;
public uint SndLimTransCwnd;
public uint SndLimTimeCwnd;
public ulong SndLimBytesCwnd;
public uint SndLimTransSnd;
public uint SndLimTimeSnd;
public ulong SndLimBytesSnd;
public uint OutOfOrderPktsIn;
[MarshalAs(UnmanagedType.U1)] public bool EcnNegotiated;
public uint EceAcksIn;
public uint PtoEpisodes;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TCP_INFO_v2
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
Public SndLimTransRwin As UInteger
Public SndLimTimeRwin As UInteger
Public SndLimBytesRwin As ULong
Public SndLimTransCwnd As UInteger
Public SndLimTimeCwnd As UInteger
Public SndLimBytesCwnd As ULong
Public SndLimTransSnd As UInteger
Public SndLimTimeSnd As UInteger
Public SndLimBytesSnd As ULong
Public OutOfOrderPktsIn As UInteger
<MarshalAs(UnmanagedType.U1)> Public EcnNegotiated As Boolean
Public EceAcksIn As UInteger
Public PtoEpisodes As UInteger
End Structureimport ctypes
from ctypes import wintypes
class TCP_INFO_v2(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),
("SndLimTransRwin", wintypes.DWORD),
("SndLimTimeRwin", wintypes.DWORD),
("SndLimBytesRwin", ctypes.c_ulonglong),
("SndLimTransCwnd", wintypes.DWORD),
("SndLimTimeCwnd", wintypes.DWORD),
("SndLimBytesCwnd", ctypes.c_ulonglong),
("SndLimTransSnd", wintypes.DWORD),
("SndLimTimeSnd", wintypes.DWORD),
("SndLimBytesSnd", ctypes.c_ulonglong),
("OutOfOrderPktsIn", wintypes.DWORD),
("EcnNegotiated", ctypes.c_byte),
("EceAcksIn", wintypes.DWORD),
("PtoEpisodes", wintypes.DWORD),
]#[repr(C)]
pub struct TCP_INFO_v2 {
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,
pub SndLimTransRwin: u32,
pub SndLimTimeRwin: u32,
pub SndLimBytesRwin: u64,
pub SndLimTransCwnd: u32,
pub SndLimTimeCwnd: u32,
pub SndLimBytesCwnd: u64,
pub SndLimTransSnd: u32,
pub SndLimTimeSnd: u32,
pub SndLimBytesSnd: u64,
pub OutOfOrderPktsIn: u32,
pub EcnNegotiated: u8,
pub EceAcksIn: u32,
pub PtoEpisodes: u32,
}import "golang.org/x/sys/windows"
type TCP_INFO_v2 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
SndLimTransRwin uint32
SndLimTimeRwin uint32
SndLimBytesRwin uint64
SndLimTransCwnd uint32
SndLimTimeCwnd uint32
SndLimBytesCwnd uint64
SndLimTransSnd uint32
SndLimTimeSnd uint32
SndLimBytesSnd uint64
OutOfOrderPktsIn uint32
EcnNegotiated byte
EceAcksIn uint32
PtoEpisodes uint32
}type
TCP_INFO_v2 = 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;
SndLimTransRwin: DWORD;
SndLimTimeRwin: DWORD;
SndLimBytesRwin: UInt64;
SndLimTransCwnd: DWORD;
SndLimTimeCwnd: DWORD;
SndLimBytesCwnd: UInt64;
SndLimTransSnd: DWORD;
SndLimTimeSnd: DWORD;
SndLimBytesSnd: UInt64;
OutOfOrderPktsIn: DWORD;
EcnNegotiated: ByteBool;
EceAcksIn: DWORD;
PtoEpisodes: DWORD;
end;const TCP_INFO_v2 = 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,
SndLimTransRwin: u32,
SndLimTimeRwin: u32,
SndLimBytesRwin: u64,
SndLimTransCwnd: u32,
SndLimTimeCwnd: u32,
SndLimBytesCwnd: u64,
SndLimTransSnd: u32,
SndLimTimeSnd: u32,
SndLimBytesSnd: u64,
OutOfOrderPktsIn: u32,
EcnNegotiated: u8,
EceAcksIn: u32,
PtoEpisodes: u32,
};type
TCP_INFO_v2 {.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: uint8
SndLimTransRwin: uint32
SndLimTimeRwin: uint32
SndLimBytesRwin: uint64
SndLimTransCwnd: uint32
SndLimTimeCwnd: uint32
SndLimBytesCwnd: uint64
SndLimTransSnd: uint32
SndLimTimeSnd: uint32
SndLimBytesSnd: uint64
OutOfOrderPktsIn: uint32
EcnNegotiated: uint8
EceAcksIn: uint32
PtoEpisodes: uint32struct TCP_INFO_v2
{
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;
uint SndLimTransRwin;
uint SndLimTimeRwin;
ulong SndLimBytesRwin;
uint SndLimTransCwnd;
uint SndLimTimeCwnd;
ulong SndLimBytesCwnd;
uint SndLimTransSnd;
uint SndLimTimeSnd;
ulong SndLimBytesSnd;
uint OutOfOrderPktsIn;
ubyte EcnNegotiated;
uint EceAcksIn;
uint PtoEpisodes;
}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_v2 サイズ: 152 バイト(x64)
dim st, 38 ; 4byte整数×38(構造体サイズ 152 / 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)
; SndLimTransRwin : DWORD (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; SndLimTimeRwin : DWORD (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; SndLimBytesRwin : ULONGLONG (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; SndLimTransCwnd : DWORD (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; SndLimTimeCwnd : DWORD (+108, 4byte) st.27 = 値 / 値 = st.27 (lpoke/lpeek も可)
; SndLimBytesCwnd : ULONGLONG (+112, 8byte) qpoke st,112,値 / qpeek(st,112) ※IronHSPのみ。3.7/3.8は lpoke st,112,下位 : lpoke st,116,上位
; SndLimTransSnd : DWORD (+120, 4byte) st.30 = 値 / 値 = st.30 (lpoke/lpeek も可)
; SndLimTimeSnd : DWORD (+124, 4byte) st.31 = 値 / 値 = st.31 (lpoke/lpeek も可)
; SndLimBytesSnd : ULONGLONG (+128, 8byte) qpoke st,128,値 / qpeek(st,128) ※IronHSPのみ。3.7/3.8は lpoke st,128,下位 : lpoke st,132,上位
; OutOfOrderPktsIn : DWORD (+136, 4byte) st.34 = 値 / 値 = st.34 (lpoke/lpeek も可)
; EcnNegotiated : BOOLEAN (+140, 1byte) poke st,140,値 / 値 = peek(st,140)
; EceAcksIn : DWORD (+144, 4byte) st.36 = 値 / 値 = st.36 (lpoke/lpeek も可)
; PtoEpisodes : DWORD (+148, 4byte) st.37 = 値 / 値 = st.37 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global TCP_INFO_v2
#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
#field int SndLimTransRwin
#field int SndLimTimeRwin
#field int64 SndLimBytesRwin
#field int SndLimTransCwnd
#field int SndLimTimeCwnd
#field int64 SndLimBytesCwnd
#field int SndLimTransSnd
#field int SndLimTimeSnd
#field int64 SndLimBytesSnd
#field int OutOfOrderPktsIn
#field bool1 EcnNegotiated
#field int EceAcksIn
#field int PtoEpisodes
#endstruct
stdim st, TCP_INFO_v2 ; NSTRUCT 変数を確保
st->State = 100
mes "State=" + st->State