Socket.SocketType プロパティ

定義

Socket の型を取得します。

public:
 property System::Net::Sockets::SocketType SocketType { System::Net::Sockets::SocketType get(); };
public System.Net.Sockets.SocketType SocketType { get; }
member this.SocketType : System.Net.Sockets.SocketType
Public ReadOnly Property SocketType As SocketType

プロパティ値

SocketType 値のいずれか 1 つ。

次のコード例では、AddressFamilySocketTypeおよび ProtocolType をコンソールに表示します。

Socket^ s = gcnew 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 = {0}", s->AddressFamily.ToString());
Console::Write("\nSocketType = {0}", s->SocketType.ToString());
Console::WriteLine("\nProtocolType = {0}", s->ProtocolType.ToString());
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());
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()))

注釈

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

適用対象

こちらもご覧ください