IPGlobalProperties.HostName Proprietà

Definizione

Ottiene il nome host per il computer locale.

public:
 abstract property System::String ^ HostName { System::String ^ get(); };
public abstract string HostName { get; }
member this.HostName : string
Public MustOverride ReadOnly Property HostName As String

Valore della proprietà

String Istanza che contiene il nome NetBIOS del computer.

Eccezioni

Chiamata di funzione Win32 non riuscita.

Esempio

Nell'esempio di codice seguente vengono visualizzate le informazioni di rete per il computer locale.

IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
Console.WriteLine("Computer name: {0}", properties.HostName);
Console.WriteLine("Domain name:   {0}", properties.DomainName);
Console.WriteLine("Node type:     {0:f}", properties.NodeType);
Console.WriteLine("DHCP scope:    {0}", properties.DhcpScopeName);
Console.WriteLine("WINS proxy?    {0}", properties.IsWinsProxy);

Commenti

Questa proprietà chiama la funzione helper IP nativa GetNetworkParams, che restituisce una struttura FIXED_INFO che contiene la stringa del nome host NetBIOS. La stringa del nome host viene troncata quando supera i 15 caratteri.

Il nome NetBIOS di un computer deve essere univoco all'interno di una rete e non è completo dal nome di dominio.

Si applica a