次の方法で共有


Socket.SocketType プロパティ

Socket の型を取得します。

Public ReadOnly Property SocketType As SocketType
[C#]
public SocketType SocketType {get;}
[C++]
public: __property SocketType get_SocketType();
[JScript]
public function get SocketType() : SocketType;

プロパティ値

SocketType 値の 1 つ。

解説

SocketType は読み取り専用で、 Socket の作成時に設定されます。

使用例

[Visual Basic, C#, C++] AddressFamilySocketType 、および ProtocolType をコンソールに表示する例を次に示します。

 
Dim s As New Socket(lep.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp)

'Using the AddressFamily, SocketType, and ProtocolType properties.
Console.WriteLine(("I just set the following properties of socket: " + "Address Family = " + s.AddressFamily.ToString() + ControlChars.Cr + "SocketType = " + s.SocketType.ToString() + ControlChars.Cr + "ProtocolType = " + s.ProtocolType.ToString()))


[C#] 
Socket s = new Socket (lep.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);

//Using the AddressFamily, SocketType, and ProtocolType properties.
Console.WriteLine ("I just set the following properties of socket: " + "Address Family = " + s.AddressFamily.ToString () + "\nSocketType = " + s.SocketType.ToString () + "\nProtocolType = " + s.ProtocolType.ToString ());


[C++] 
Socket *s = new Socket(lep->Address->AddressFamily,
    SocketType::Stream, ProtocolType::Tcp);

//Uses the AddressFamily, SocketType, and ProtocolType properties.
Console::Write("I just set the following properties of socket: \n");
Console::Write("Address Family = ");
Console::Write(__box(s->AddressFamily)->ToString());
Console::Write("\nSocketType = ");
Console::Write(__box(s->SocketType)->ToString());
Console::Write("\nProtocolType = ");
Console::WriteLine(__box(s->ProtocolType)->ToString());

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

参照

Socket クラス | Socket メンバ | System.Net.Sockets 名前空間 | SocketType