Udostępnij przez


Socket.AddressFamily Właściwość

Definicja

Pobiera rodzinę adresów .Socket

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

Wartość właściwości

Jedna z AddressFamily wartości.

Przykłady

W poniższym przykładzie kodu jest wyświetlana AddressFamilykonsola , SocketTypei ProtocolType .

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()))

Uwagi

Określa AddressFamily schemat adresowania, którego może używać wystąpienie Socket klasy. Ta właściwość jest tylko do odczytu i jest ustawiana podczas Socket tworzenia.

Dotyczy

Zobacz też