Esempio n. 1
0
        /// <summary>Gets the host name of the local computer.</summary>
        /// <returns>A string that contains the DNS host name of the local computer.</returns>
        /// <exception cref="T:System.Net.Sockets.SocketException">An error is encountered when resolving the local host name. </exception>
        /// <PermissionSet>
        ///   <IPermission class="System.Net.DnsPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
        /// </PermissionSet>
        public static string GetHostName()
        {
            string result;

            if (!Dns.GetHostName_internal(out result))
            {
                throw new System.Net.Sockets.SocketException(11001);
            }
            return(result);
        }