select
関数シグネチャ
// WS2_32.dll
#include <windows.h>
INT select(
INT nfds,
FD_SET* readfds, // optional
FD_SET* writefds, // optional
FD_SET* exceptfds, // optional
const TIMEVAL* timeout // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| nfds | INT | in | 無視されます。nfds パラメーターは、Berkeley ソケットとの互換性のためにのみ含まれています。 |
| readfds | FD_SET* | inoutoptional | 読み取り可能かどうかを確認するソケットのセットへの省略可能なポインター。 |
| writefds | FD_SET* | inoutoptional | 書き込み可能かどうかを確認するソケットのセットへの省略可能なポインター。 |
| exceptfds | FD_SET* | inoutoptional | エラーの有無を確認するソケットのセットへの省略可能なポインター。 |
| timeout | TIMEVAL* | inoptional | select が待機する最大時間。 TIMEVAL 構造体の形式で指定します。ブロッキング操作の場合は、timeout パラメーターを null に設定します。 |
戻り値の型: INT
公式ドキュメント
select 関数は、1 つ以上のソケットの状態を判定し、同期 I/O を実行するために必要に応じて待機します。
戻り値
select 関数は、準備が完了し fd_set 構造体に含まれるソケットハンドルの総数を返します。制限時間が経過した場合は 0 を、エラーが発生した場合は SOCKET_ERROR を返します。戻り値が SOCKET_ERROR の場合は、 WSAGetLastError を使用して特定のエラーコードを取得できます。
| エラーコード | 意味 |
|---|---|
| この関数を使用する前に、 WSAStartup の呼び出しが成功している必要があります。 | |
| Windows Sockets 実装が内部操作に必要なリソースを割り当てられなかったか、readfds、writefds、exceptfds、または timeval パラメーターがユーザーアドレス空間の一部ではありません。 | |
| ネットワークサブシステムが失敗しました。 | |
| time-out 値が無効な場合、または 3 つの記述子パラメーターすべてが null ポインターであるか、ソケットを含まない空の fd_set 構造体への有効なポインターである場合に、WSAEINVAL が返されます。 | |
| ブロッキング中の Windows Socket 1.1 呼び出しが WSACancelBlockingCall によってキャンセルされました。 | |
| ブロッキング中の Windows Sockets 1.1 呼び出しが進行中であるか、サービスプロバイダーがコールバック関数を処理中です。 | |
| 記述子セットのいずれかに、ソケットではないエントリが含まれています。 |
解説(Remarks)
select 関数は、1 つ以上のソケットの状態を判定するために使用します。各ソケットについて、呼び出し側は読み取り、書き込み、またはエラーの状態に関する情報を要求できます。特定の状態を要求するソケットのセットは、 fd_set 構造体によって指定します。 fd_set 構造体に含まれるソケットは、単一のサービスプロバイダーに関連付けられている必要があります。この制限上、各ソケットのプロトコルを記述する WSAPROTOCOL_INFO 構造体の providerId 値が同じであれば、それらのソケットは同じサービスプロバイダーに属すると見なされます。戻り時には、これらの構造体は、指定された条件を満たすソケットのサブセットを反映するように更新されます。 select 関数は、条件を満たすソケットの数を返します。 fd_set 構造体を操作するための一連のマクロが用意されています。これらのマクロは Berkeley ソフトウェアで使用されているものと互換性がありますが、内部表現は完全に異なります。
readfds パラメーターは、読み取り可能かどうかを確認するソケットを指定します。ソケットが現在 listen 状態にある場合、着信接続要求を受信して accept がブロックせずに完了することが保証されているときに、読み取り可能としてマークされます。その他のソケットの場合、読み取り可能とは、 recv、 WSARecv、 WSARecvFrom、または recvfrom の呼び出しがブロックしないことが保証される程度に、キューに格納されたデータが読み取り可能であることを意味します。
コネクション指向のソケットの場合、読み取り可能であることは、ソケットを閉じる要求がピアから受信されたことを示す場合もあります。仮想回線が正常に閉じられ、すべてのデータが受信された場合、 recv は読み取りバイト数 0 で直ちに返ります。仮想回線がリセットされた場合、 recv は WSAECONNRESET などのエラーコードを伴って直ちに完了します。ソケットオプション SO_OOBINLINE が有効になっている場合は、OOB データの有無も確認されます ( setsockopt を参照)。
writefds パラメーターは、書き込み可能かどうかを確認するソケットを指定します。ソケットが connect 呼び出し (非ブロッキング) を処理中の場合、接続の確立が正常に完了するとソケットは書き込み可能になります。ソケットが connect 呼び出しを処理していない場合、書き込み可能とは、 send、 sendto、または WSASendto が成功することが保証されることを意味します。ただし、len パラメーターが利用可能な送信システムバッファー空間の容量を超える場合、ブロッキングソケットではブロックする可能性があります。これらの保証がどれくらいの期間有効であると想定できるかは、特にマルチスレッド環境では規定されていません。
exceptfds パラメーターは、OOB データの有無や例外的なエラー状態を確認するソケットを指定します。
まとめると、 select が返るときに、ソケットが特定のセット内で識別されるのは次の場合です。
readfds:
- listen が呼び出され、接続が保留中で、 accept が成功する場合。
- 読み取り可能なデータがある場合 (SO_OOBINLINE が有効な場合は OOB データを含む)。
- 接続が閉じられた/リセットされた/終了した場合。
- connect 呼び出し (非ブロッキング) を処理中で、接続が成功した場合。
- データを送信できる場合。
- connect 呼び出し (非ブロッキング) を処理中で、接続試行が失敗した場合。
- 読み取り可能な OOB データがある場合 (SO_OOBINLINE が無効な場合のみ)。
- FD_ZERO(*set) - set を空のセットに初期化します。使用前にセットは常にクリアする必要があります。
- FD_CLR(s, *set) - ソケット s を set から削除します。
- FD_ISSET(s, *set) - s が set のメンバーかどうかを確認し、メンバーであれば TRUE を返します。
- FD_SET(s, *set) - ソケット s を set に追加します。
time-out パラメーターは、 select が完了するまでにかかる時間を制御します。time-out が null ポインターの場合、 select は少なくとも 1 つの記述子が指定された条件を満たすまで無期限にブロックします。それ以外の場合、time-out は TIMEVAL 構造体を指し、 select が返るまでに待機する最大時間を指定します。 select が返るとき、TIMEVAL 構造体の内容は変更されません。TIMEVAL が {0, 0} に初期化されている場合、 select は直ちに返ります。これは、選択したソケットの状態をポーリングするために使用されます。 select が直ちに返る場合、その select 呼び出しは非ブロッキングと見なされ、非ブロッキング呼び出しに関する標準的な前提が適用されます。たとえば、ブロッキングフックは呼び出されず、Windows Sockets は処理を譲りません。
Windows 8.1 および Windows Server 2012 R2: この関数は、Windows 8.1、Windows Server 2012 R2 以降の Windows ストアアプリでサポートされています。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// WS2_32.dll
#include <windows.h>
INT select(
INT nfds,
FD_SET* readfds, // optional
FD_SET* writefds, // optional
FD_SET* exceptfds, // optional
const TIMEVAL* timeout // optional
);[DllImport("WS2_32.dll", SetLastError = true, ExactSpelling = true)]
static extern int select(
int nfds, // INT
IntPtr readfds, // FD_SET* optional, in/out
IntPtr writefds, // FD_SET* optional, in/out
IntPtr exceptfds, // FD_SET* optional, in/out
IntPtr timeout // TIMEVAL* optional
);<DllImport("WS2_32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function select(
nfds As Integer, ' INT
readfds As IntPtr, ' FD_SET* optional, in/out
writefds As IntPtr, ' FD_SET* optional, in/out
exceptfds As IntPtr, ' FD_SET* optional, in/out
timeout As IntPtr ' TIMEVAL* optional
) As Integer
End Function' nfds : INT
' readfds : FD_SET* optional, in/out
' writefds : FD_SET* optional, in/out
' exceptfds : FD_SET* optional, in/out
' timeout : TIMEVAL* optional
Declare PtrSafe Function select Lib "ws2_32" ( _
ByVal nfds As Long, _
ByVal readfds As LongPtr, _
ByVal writefds As LongPtr, _
ByVal exceptfds As LongPtr, _
ByVal timeout As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
select = ctypes.windll.ws2_32.select
select.restype = ctypes.c_int
select.argtypes = [
ctypes.c_int, # nfds : INT
ctypes.c_void_p, # readfds : FD_SET* optional, in/out
ctypes.c_void_p, # writefds : FD_SET* optional, in/out
ctypes.c_void_p, # exceptfds : FD_SET* optional, in/out
ctypes.c_void_p, # timeout : TIMEVAL* optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WS2_32.dll')
select = Fiddle::Function.new(
lib['select'],
[
Fiddle::TYPE_INT, # nfds : INT
Fiddle::TYPE_VOIDP, # readfds : FD_SET* optional, in/out
Fiddle::TYPE_VOIDP, # writefds : FD_SET* optional, in/out
Fiddle::TYPE_VOIDP, # exceptfds : FD_SET* optional, in/out
Fiddle::TYPE_VOIDP, # timeout : TIMEVAL* optional
],
Fiddle::TYPE_INT)#[link(name = "ws2_32")]
extern "system" {
fn select(
nfds: i32, // INT
readfds: *mut FD_SET, // FD_SET* optional, in/out
writefds: *mut FD_SET, // FD_SET* optional, in/out
exceptfds: *mut FD_SET, // FD_SET* optional, in/out
timeout: *const TIMEVAL // TIMEVAL* optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WS2_32.dll", SetLastError = true)]
public static extern int select(int nfds, IntPtr readfds, IntPtr writefds, IntPtr exceptfds, IntPtr timeout);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WS2_32_select' -Namespace Win32 -PassThru
# $api::select(nfds, readfds, writefds, exceptfds, timeout)#uselib "WS2_32.dll"
#func global select "select" sptr, sptr, sptr, sptr, sptr
; select nfds, varptr(readfds), varptr(writefds), varptr(exceptfds), varptr(timeout) ; 戻り値は stat
; nfds : INT -> "sptr"
; readfds : FD_SET* optional, in/out -> "sptr"
; writefds : FD_SET* optional, in/out -> "sptr"
; exceptfds : FD_SET* optional, in/out -> "sptr"
; timeout : TIMEVAL* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WS2_32.dll" #cfunc global select "select" int, var, var, var, var ; res = select(nfds, readfds, writefds, exceptfds, timeout) ; nfds : INT -> "int" ; readfds : FD_SET* optional, in/out -> "var" ; writefds : FD_SET* optional, in/out -> "var" ; exceptfds : FD_SET* optional, in/out -> "var" ; timeout : TIMEVAL* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WS2_32.dll" #cfunc global select "select" int, sptr, sptr, sptr, sptr ; res = select(nfds, varptr(readfds), varptr(writefds), varptr(exceptfds), varptr(timeout)) ; nfds : INT -> "int" ; readfds : FD_SET* optional, in/out -> "sptr" ; writefds : FD_SET* optional, in/out -> "sptr" ; exceptfds : FD_SET* optional, in/out -> "sptr" ; timeout : TIMEVAL* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
; INT select(INT nfds, FD_SET* readfds, FD_SET* writefds, FD_SET* exceptfds, TIMEVAL* timeout) #uselib "WS2_32.dll" #cfunc global select "select" int, var, var, var, var ; res = select(nfds, readfds, writefds, exceptfds, timeout) ; nfds : INT -> "int" ; readfds : FD_SET* optional, in/out -> "var" ; writefds : FD_SET* optional, in/out -> "var" ; exceptfds : FD_SET* optional, in/out -> "var" ; timeout : TIMEVAL* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT select(INT nfds, FD_SET* readfds, FD_SET* writefds, FD_SET* exceptfds, TIMEVAL* timeout) #uselib "WS2_32.dll" #cfunc global select "select" int, intptr, intptr, intptr, intptr ; res = select(nfds, varptr(readfds), varptr(writefds), varptr(exceptfds), varptr(timeout)) ; nfds : INT -> "int" ; readfds : FD_SET* optional, in/out -> "intptr" ; writefds : FD_SET* optional, in/out -> "intptr" ; exceptfds : FD_SET* optional, in/out -> "intptr" ; timeout : TIMEVAL* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ws2_32 = windows.NewLazySystemDLL("WS2_32.dll")
procselect = ws2_32.NewProc("select")
)
// nfds (INT), readfds (FD_SET* optional, in/out), writefds (FD_SET* optional, in/out), exceptfds (FD_SET* optional, in/out), timeout (TIMEVAL* optional)
r1, _, err := procselect.Call(
uintptr(nfds),
uintptr(readfds),
uintptr(writefds),
uintptr(exceptfds),
uintptr(timeout),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction select(
nfds: Integer; // INT
readfds: Pointer; // FD_SET* optional, in/out
writefds: Pointer; // FD_SET* optional, in/out
exceptfds: Pointer; // FD_SET* optional, in/out
timeout: Pointer // TIMEVAL* optional
): Integer; stdcall;
external 'WS2_32.dll' name 'select';result := DllCall("WS2_32\select"
, "Int", nfds ; INT
, "Ptr", readfds ; FD_SET* optional, in/out
, "Ptr", writefds ; FD_SET* optional, in/out
, "Ptr", exceptfds ; FD_SET* optional, in/out
, "Ptr", timeout ; TIMEVAL* optional
, "Int") ; return: INT●select(nfds, readfds, writefds, exceptfds, timeout) = DLL("WS2_32.dll", "int select(int, void*, void*, void*, void*)")
# 呼び出し: select(nfds, readfds, writefds, exceptfds, timeout)
# nfds : INT -> "int"
# readfds : FD_SET* optional, in/out -> "void*"
# writefds : FD_SET* optional, in/out -> "void*"
# exceptfds : FD_SET* optional, in/out -> "void*"
# timeout : TIMEVAL* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "ws2_32" fn select(
nfds: i32, // INT
readfds: [*c]FD_SET, // FD_SET* optional, in/out
writefds: [*c]FD_SET, // FD_SET* optional, in/out
exceptfds: [*c]FD_SET, // FD_SET* optional, in/out
timeout: [*c]TIMEVAL // TIMEVAL* optional
) callconv(std.os.windows.WINAPI) i32;proc select(
nfds: int32, # INT
readfds: ptr FD_SET, # FD_SET* optional, in/out
writefds: ptr FD_SET, # FD_SET* optional, in/out
exceptfds: ptr FD_SET, # FD_SET* optional, in/out
timeout: ptr TIMEVAL # TIMEVAL* optional
): int32 {.importc: "select", stdcall, dynlib: "WS2_32.dll".}pragma(lib, "ws2_32");
extern(Windows)
int select(
int nfds, // INT
FD_SET* readfds, // FD_SET* optional, in/out
FD_SET* writefds, // FD_SET* optional, in/out
FD_SET* exceptfds, // FD_SET* optional, in/out
TIMEVAL* timeout // TIMEVAL* optional
);ccall((:select, "WS2_32.dll"), stdcall, Int32,
(Int32, Ptr{FD_SET}, Ptr{FD_SET}, Ptr{FD_SET}, Ptr{TIMEVAL}),
nfds, readfds, writefds, exceptfds, timeout)
# nfds : INT -> Int32
# readfds : FD_SET* optional, in/out -> Ptr{FD_SET}
# writefds : FD_SET* optional, in/out -> Ptr{FD_SET}
# exceptfds : FD_SET* optional, in/out -> Ptr{FD_SET}
# timeout : TIMEVAL* optional -> Ptr{TIMEVAL}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t select(
int32_t nfds,
void* readfds,
void* writefds,
void* exceptfds,
void* timeout);
]]
local ws2_32 = ffi.load("ws2_32")
-- ws2_32.select(nfds, readfds, writefds, exceptfds, timeout)
-- nfds : INT
-- readfds : FD_SET* optional, in/out
-- writefds : FD_SET* optional, in/out
-- exceptfds : FD_SET* optional, in/out
-- timeout : TIMEVAL* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WS2_32.dll');
const select = lib.func('__stdcall', 'select', 'int32_t', ['int32_t', 'void *', 'void *', 'void *', 'void *']);
// select(nfds, readfds, writefds, exceptfds, timeout)
// nfds : INT -> 'int32_t'
// readfds : FD_SET* optional, in/out -> 'void *'
// writefds : FD_SET* optional, in/out -> 'void *'
// exceptfds : FD_SET* optional, in/out -> 'void *'
// timeout : TIMEVAL* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WS2_32.dll", {
select: { parameters: ["i32", "pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.select(nfds, readfds, writefds, exceptfds, timeout)
// nfds : INT -> "i32"
// readfds : FD_SET* optional, in/out -> "pointer"
// writefds : FD_SET* optional, in/out -> "pointer"
// exceptfds : FD_SET* optional, in/out -> "pointer"
// timeout : TIMEVAL* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t select(
int32_t nfds,
void* readfds,
void* writefds,
void* exceptfds,
void* timeout);
C, "WS2_32.dll");
// $ffi->select(nfds, readfds, writefds, exceptfds, timeout);
// nfds : INT
// readfds : FD_SET* optional, in/out
// writefds : FD_SET* optional, in/out
// exceptfds : FD_SET* optional, in/out
// timeout : TIMEVAL* optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Ws2_32 extends StdCallLibrary {
Ws2_32 INSTANCE = Native.load("ws2_32", Ws2_32.class);
int select(
int nfds, // INT
Pointer readfds, // FD_SET* optional, in/out
Pointer writefds, // FD_SET* optional, in/out
Pointer exceptfds, // FD_SET* optional, in/out
Pointer timeout // TIMEVAL* optional
);
}@[Link("ws2_32")]
lib LibWS2_32
fun select = select(
nfds : Int32, # INT
readfds : FD_SET*, # FD_SET* optional, in/out
writefds : FD_SET*, # FD_SET* optional, in/out
exceptfds : FD_SET*, # FD_SET* optional, in/out
timeout : TIMEVAL* # TIMEVAL* optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef selectNative = Int32 Function(Int32, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef selectDart = int Function(int, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>);
final select = DynamicLibrary.open('WS2_32.dll')
.lookupFunction<selectNative, selectDart>('select');
// nfds : INT -> Int32
// readfds : FD_SET* optional, in/out -> Pointer<Void>
// writefds : FD_SET* optional, in/out -> Pointer<Void>
// exceptfds : FD_SET* optional, in/out -> Pointer<Void>
// timeout : TIMEVAL* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function select(
nfds: Integer; // INT
readfds: Pointer; // FD_SET* optional, in/out
writefds: Pointer; // FD_SET* optional, in/out
exceptfds: Pointer; // FD_SET* optional, in/out
timeout: Pointer // TIMEVAL* optional
): Integer; stdcall;
external 'WS2_32.dll' name 'select';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "select"
c_select :: Int32 -> Ptr () -> Ptr () -> Ptr () -> Ptr () -> IO Int32
-- nfds : INT -> Int32
-- readfds : FD_SET* optional, in/out -> Ptr ()
-- writefds : FD_SET* optional, in/out -> Ptr ()
-- exceptfds : FD_SET* optional, in/out -> Ptr ()
-- timeout : TIMEVAL* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let select =
foreign "select"
(int32_t @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* nfds : INT -> int32_t *)
(* readfds : FD_SET* optional, in/out -> (ptr void) *)
(* writefds : FD_SET* optional, in/out -> (ptr void) *)
(* exceptfds : FD_SET* optional, in/out -> (ptr void) *)
(* timeout : TIMEVAL* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library ws2_32 (t "WS2_32.dll"))
(cffi:use-foreign-library ws2_32)
(cffi:defcfun ("select" select :convention :stdcall) :int32
(nfds :int32) ; INT
(readfds :pointer) ; FD_SET* optional, in/out
(writefds :pointer) ; FD_SET* optional, in/out
(exceptfds :pointer) ; FD_SET* optional, in/out
(timeout :pointer)) ; TIMEVAL* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $select = Win32::API::More->new('WS2_32',
'int select(int nfds, LPVOID readfds, LPVOID writefds, LPVOID exceptfds, LPVOID timeout)');
# my $ret = $select->Call($nfds, $readfds, $writefds, $exceptfds, $timeout);
# nfds : INT -> int
# readfds : FD_SET* optional, in/out -> LPVOID
# writefds : FD_SET* optional, in/out -> LPVOID
# exceptfds : FD_SET* optional, in/out -> LPVOID
# timeout : TIMEVAL* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
- f WSAAsyncSelect — ソケットのネットワークイベント通知をウィンドウメッセージで要求する。
- f WSAEventSelect — ソケットのネットワークイベントをイベントオブジェクトに関連付ける。
- f accept — 接続要求を受け入れ新しいソケットを生成する。
- f connect — 指定アドレスへのソケット接続を確立する。
- f recv — 接続ソケットからデータを受信する。
- f recvfrom — ソケットからデータを受信し送信元アドレスを取得する。
- f send — 接続ソケットへデータを送信する。