Socket.AddressFamily-Eigenschaft
Ruft die Adressfamilie des Socket ab.
Namespace: System.Net.Sockets
Assembly: System (in system.dll)
Syntax
'Declaration
Public ReadOnly Property AddressFamily As AddressFamily
'Usage
Dim instance As Socket
Dim value As AddressFamily
value = instance.AddressFamily
public AddressFamily AddressFamily { get; }
public:
property AddressFamily AddressFamily {
AddressFamily get ();
}
/** @property */
public AddressFamily get_AddressFamily ()
public function get AddressFamily () : AddressFamily
Eigenschaftenwert
Einer der AddressFamily-Werte.
Hinweise
AddressFamily gibt das Adressierungsschema an, das eine Instanz der Socket-Klasse verwenden kann. Diese Eigenschaft ist schreibgeschützt und wird beim Erstellen des Socket festgelegt.
Beispiel
Im folgenden Codebeispiel werden AddressFamily, SocketType und ProtocolType auf der Konsole angezeigt.
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()))
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 ());
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.get_Address().get_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.get_AddressFamily().ToString()
+ "\nSocketType = " + s.get_SocketType().ToString()
+ "\nProtocolType = " + s.get_ProtocolType().ToString());
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
Socket-Klasse
Socket-Member
System.Net.Sockets-Namespace
AddressFamily-Enumeration