ホーム › NetworkManagement.IpHelper › MIB_UDPSTATS2
MIB_UDPSTATS2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dw64InDatagrams | ULONGLONG | 8 | +0 | +0 | 配送されたUDPデータグラムの受信総数を64ビット値で示す。 |
| dwNoPorts | DWORD | 4 | +8 | +8 | 宛先ポートにアプリが存在せず破棄されたデータグラム数である。 |
| dwInErrors | DWORD | 4 | +12 | +12 | ポート不在以外の誤りで配送不能だった受信データグラム数である。 |
| dw64OutDatagrams | ULONGLONG | 8 | +16 | +16 | 送信されたUDPデータグラムの総数を64ビット値で示す。 |
| dwNumAddrs | DWORD | 4 | +24 | +24 | リスニング中のローカルエンドポイント(アドレス)数を示す。 |
各言語での定義
#include <windows.h>
// MIB_UDPSTATS2 (x64 32 / x86 32 バイト)
typedef struct MIB_UDPSTATS2 {
ULONGLONG dw64InDatagrams;
DWORD dwNoPorts;
DWORD dwInErrors;
ULONGLONG dw64OutDatagrams;
DWORD dwNumAddrs;
} MIB_UDPSTATS2;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MIB_UDPSTATS2
{
public ulong dw64InDatagrams;
public uint dwNoPorts;
public uint dwInErrors;
public ulong dw64OutDatagrams;
public uint dwNumAddrs;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MIB_UDPSTATS2
Public dw64InDatagrams As ULong
Public dwNoPorts As UInteger
Public dwInErrors As UInteger
Public dw64OutDatagrams As ULong
Public dwNumAddrs As UInteger
End Structureimport ctypes
from ctypes import wintypes
class MIB_UDPSTATS2(ctypes.Structure):
_fields_ = [
("dw64InDatagrams", ctypes.c_ulonglong),
("dwNoPorts", wintypes.DWORD),
("dwInErrors", wintypes.DWORD),
("dw64OutDatagrams", ctypes.c_ulonglong),
("dwNumAddrs", wintypes.DWORD),
]#[repr(C)]
pub struct MIB_UDPSTATS2 {
pub dw64InDatagrams: u64,
pub dwNoPorts: u32,
pub dwInErrors: u32,
pub dw64OutDatagrams: u64,
pub dwNumAddrs: u32,
}import "golang.org/x/sys/windows"
type MIB_UDPSTATS2 struct {
dw64InDatagrams uint64
dwNoPorts uint32
dwInErrors uint32
dw64OutDatagrams uint64
dwNumAddrs uint32
}type
MIB_UDPSTATS2 = record
dw64InDatagrams: UInt64;
dwNoPorts: DWORD;
dwInErrors: DWORD;
dw64OutDatagrams: UInt64;
dwNumAddrs: DWORD;
end;const MIB_UDPSTATS2 = extern struct {
dw64InDatagrams: u64,
dwNoPorts: u32,
dwInErrors: u32,
dw64OutDatagrams: u64,
dwNumAddrs: u32,
};type
MIB_UDPSTATS2 {.bycopy.} = object
dw64InDatagrams: uint64
dwNoPorts: uint32
dwInErrors: uint32
dw64OutDatagrams: uint64
dwNumAddrs: uint32struct MIB_UDPSTATS2
{
ulong dw64InDatagrams;
uint dwNoPorts;
uint dwInErrors;
ulong dw64OutDatagrams;
uint dwNumAddrs;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MIB_UDPSTATS2 サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; dw64InDatagrams : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; dwNoPorts : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwInErrors : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dw64OutDatagrams : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; dwNumAddrs : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MIB_UDPSTATS2
#field int64 dw64InDatagrams
#field int dwNoPorts
#field int dwInErrors
#field int64 dw64OutDatagrams
#field int dwNumAddrs
#endstruct
stdim st, MIB_UDPSTATS2 ; NSTRUCT 変数を確保
st->dw64InDatagrams = 100
mes "dw64InDatagrams=" + st->dw64InDatagrams