Win32 API 日本語リファレンス
ホームNetworking.WinInet › INTERNET_SERVER_CONNECTION_STATE

INTERNET_SERVER_CONNECTION_STATE

構造体
サイズx64: 40 バイト / x86: 32 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
lpcwszHostNameLPWSTR8/4+0+0対象サーバのホスト名文字列である。
fProxyBOOL4+8+4プロキシ経由の接続かどうかを示す真偽値である。
dwCounterDWORD4+12+8接続状態を識別する内部カウンタ値である。
dwConnectionLimitDWORD4+16+12このサーバへの最大同時接続数である。
dwAvailableCreatesDWORD4+20+16新規に作成可能な接続の残り数である。
dwAvailableKeepAlivesDWORD4+24+20再利用可能なキープアライブ接続の数である。
dwActiveConnectionsDWORD4+28+24現在アクティブな接続の数である。
dwWaitersDWORD4+32+28接続を待機しているリクエストの数である。

各言語での定義

#include <windows.h>

// INTERNET_SERVER_CONNECTION_STATE  (x64 40 / x86 32 バイト)
typedef struct INTERNET_SERVER_CONNECTION_STATE {
    LPWSTR lpcwszHostName;
    BOOL fProxy;
    DWORD dwCounter;
    DWORD dwConnectionLimit;
    DWORD dwAvailableCreates;
    DWORD dwAvailableKeepAlives;
    DWORD dwActiveConnections;
    DWORD dwWaiters;
} INTERNET_SERVER_CONNECTION_STATE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct INTERNET_SERVER_CONNECTION_STATE
{
    public IntPtr lpcwszHostName;
    [MarshalAs(UnmanagedType.Bool)] public bool fProxy;
    public uint dwCounter;
    public uint dwConnectionLimit;
    public uint dwAvailableCreates;
    public uint dwAvailableKeepAlives;
    public uint dwActiveConnections;
    public uint dwWaiters;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure INTERNET_SERVER_CONNECTION_STATE
    Public lpcwszHostName As IntPtr
    <MarshalAs(UnmanagedType.Bool)> Public fProxy As Boolean
    Public dwCounter As UInteger
    Public dwConnectionLimit As UInteger
    Public dwAvailableCreates As UInteger
    Public dwAvailableKeepAlives As UInteger
    Public dwActiveConnections As UInteger
    Public dwWaiters As UInteger
End Structure
import ctypes
from ctypes import wintypes

class INTERNET_SERVER_CONNECTION_STATE(ctypes.Structure):
    _fields_ = [
        ("lpcwszHostName", ctypes.c_void_p),
        ("fProxy", wintypes.BOOL),
        ("dwCounter", wintypes.DWORD),
        ("dwConnectionLimit", wintypes.DWORD),
        ("dwAvailableCreates", wintypes.DWORD),
        ("dwAvailableKeepAlives", wintypes.DWORD),
        ("dwActiveConnections", wintypes.DWORD),
        ("dwWaiters", wintypes.DWORD),
    ]
#[repr(C)]
pub struct INTERNET_SERVER_CONNECTION_STATE {
    pub lpcwszHostName: *mut core::ffi::c_void,
    pub fProxy: i32,
    pub dwCounter: u32,
    pub dwConnectionLimit: u32,
    pub dwAvailableCreates: u32,
    pub dwAvailableKeepAlives: u32,
    pub dwActiveConnections: u32,
    pub dwWaiters: u32,
}
import "golang.org/x/sys/windows"

type INTERNET_SERVER_CONNECTION_STATE struct {
	lpcwszHostName uintptr
	fProxy int32
	dwCounter uint32
	dwConnectionLimit uint32
	dwAvailableCreates uint32
	dwAvailableKeepAlives uint32
	dwActiveConnections uint32
	dwWaiters uint32
}
type
  INTERNET_SERVER_CONNECTION_STATE = record
    lpcwszHostName: Pointer;
    fProxy: BOOL;
    dwCounter: DWORD;
    dwConnectionLimit: DWORD;
    dwAvailableCreates: DWORD;
    dwAvailableKeepAlives: DWORD;
    dwActiveConnections: DWORD;
    dwWaiters: DWORD;
  end;
const INTERNET_SERVER_CONNECTION_STATE = extern struct {
    lpcwszHostName: ?*anyopaque,
    fProxy: i32,
    dwCounter: u32,
    dwConnectionLimit: u32,
    dwAvailableCreates: u32,
    dwAvailableKeepAlives: u32,
    dwActiveConnections: u32,
    dwWaiters: u32,
};
type
  INTERNET_SERVER_CONNECTION_STATE {.bycopy.} = object
    lpcwszHostName: pointer
    fProxy: int32
    dwCounter: uint32
    dwConnectionLimit: uint32
    dwAvailableCreates: uint32
    dwAvailableKeepAlives: uint32
    dwActiveConnections: uint32
    dwWaiters: uint32
struct INTERNET_SERVER_CONNECTION_STATE
{
    void* lpcwszHostName;
    int fProxy;
    uint dwCounter;
    uint dwConnectionLimit;
    uint dwAvailableCreates;
    uint dwAvailableKeepAlives;
    uint dwActiveConnections;
    uint dwWaiters;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; INTERNET_SERVER_CONNECTION_STATE サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; lpcwszHostName : LPWSTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; fProxy : BOOL (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwCounter : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwConnectionLimit : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwAvailableCreates : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwAvailableKeepAlives : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwActiveConnections : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwWaiters : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; INTERNET_SERVER_CONNECTION_STATE サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; lpcwszHostName : LPWSTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; fProxy : BOOL (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwCounter : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwConnectionLimit : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwAvailableCreates : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwAvailableKeepAlives : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwActiveConnections : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwWaiters : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global INTERNET_SERVER_CONNECTION_STATE
    #field intptr lpcwszHostName
    #field bool fProxy
    #field int dwCounter
    #field int dwConnectionLimit
    #field int dwAvailableCreates
    #field int dwAvailableKeepAlives
    #field int dwActiveConnections
    #field int dwWaiters
#endstruct

stdim st, INTERNET_SERVER_CONNECTION_STATE        ; NSTRUCT 変数を確保
st->fProxy = 100
mes "fProxy=" + st->fProxy