SocketOptionLevel 列挙型

定義

SetSocketOption(SocketOptionLevel, SocketOptionName, Int32) メソッドと GetSocketOption(SocketOptionLevel, SocketOptionName) メソッドのソケット オプション レベルを定義します。

public enum class SocketOptionLevel
public enum SocketOptionLevel
type SocketOptionLevel = 
Public Enum SocketOptionLevel
継承
SocketOptionLevel

フィールド

IP 0

Socket オプションは IP ソケットだけに適用されます。

IPv6 41

Socket オプションは IPv6 ソケットだけに適用されます。

Socket 65535

Socket オプションはすべてのソケットに適用されます。

Tcp 6

Socket オプションは TCP ソケットだけに適用されます。

Udp 17

Socket オプションは UDP ソケットだけに適用されます。

次の例では、この列挙体を使用してソケット オプションを設定します。

// Specifies that send operations will time-out 
// if confirmation is not received within 1000 milliseconds.
s->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::SendTimeout, 1000 );

// Specifies that the Socket will linger for 10 seconds after Close is called.
LingerOption^ lingerOption = gcnew LingerOption( true,10 );

s->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::Linger, lingerOption );
// Send operations will time-out if confirmation
// is not received within 1000 milliseconds.
s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 1000);

// The socket will linger for 10 seconds after Socket.Close is called.
LingerOption lingerOption = new LingerOption (true, 10);

s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Linger, lingerOption);
'Send operations will time-out if confirmation is 
' not received within 1000 milliseconds.
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 1000)

' The socket will linger for 10 seconds after Socket.Close is called.
Dim lingerOption As New LingerOption(True, 10)
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, lingerOption)

注釈

列挙体はSocketOptionLevel、メソッドに渡すことができるソケット オプション レベルをSocket.SetSocketOptionSocket.GetSocketOption定義します。 SocketOptionName 列挙値は次のように SocketOptionLevelグループ化されます。

メモ Windows XP で IPv6 を使用するには、Windows XP 用の Advance Networking Pack をインストールします。

適用対象

こちらもご覧ください