GetHostName() 공개 정적인 메소드

public static GetHostName ( ) : string
리턴 string
예제 #1
0
        /// <summary>Gets the host name of the local machine.</summary>
        public static string GetHostName()
        {
            NameResolutionPal.EnsureSocketsAreInitialized();

            ValueStopwatch stopwatch = NameResolutionTelemetry.Log.BeforeResolution(string.Empty);

            string name;

            try
            {
                name = NameResolutionPal.GetHostName();
            }
            catch when(LogFailure(stopwatch))
            {
                Debug.Fail("LogFailure should return false");
                throw;
            }

            if (NameResolutionTelemetry.Log.IsEnabled())
            {
                NameResolutionTelemetry.Log.AfterResolution(stopwatch, successful: true);
            }

            if (NetEventSource.Log.IsEnabled())
            {
                NetEventSource.Info(null, name);
            }
            return(name);
        }
예제 #2
0
파일: DNS.cs 프로젝트: zuhuizou/corefx
        } // InternalGetHostByAddress

        /*****************************************************************************
         * Function :    gethostname
         *
         * Abstract:     Queries the hostname from DNS
         *
         * Input Parameters:
         *
         * Returns: String
         ******************************************************************************/

        /// <devdoc>
        ///    <para>Gets the host name of the local machine.</para>
        /// </devdoc>
        public static string GetHostName()
        {
            if (GlobalLog.IsEnabled)
            {
                GlobalLog.Print("Dns.GetHostName");
            }

            return(NameResolutionPal.GetHostName());
        }
예제 #3
0
        /// <summary>Gets the host name of the local machine.</summary>
        public static string GetHostName()
        {
            if (NetEventSource.IsEnabled)
            {
                NetEventSource.Info(null, null);
            }
            NameResolutionPal.EnsureSocketsAreInitialized();

            return(NameResolutionPal.GetHostName());
        }
예제 #4
0
파일: DNS.cs 프로젝트: o-mdr/corefx
        } // InternalGetHostByAddress

        /*****************************************************************************
         * Function :    gethostname
         *
         * Abstract:     Queries the hostname from DNS
         *
         * Input Parameters:
         *
         * Returns: String
         ******************************************************************************/

        /// <devdoc>
        ///    <para>Gets the host name of the local machine.</para>
        /// </devdoc>
        public static string GetHostName()
        {
            if (GlobalLog.IsEnabled)
            {
                GlobalLog.Print("Dns.GetHostName");
            }

            NameResolutionPal.EnsureSocketsAreInitialized();
            return(NameResolutionPal.GetHostName());
        }
예제 #5
0
        /// <summary>Gets the host name of the local machine.</summary>
        public static string GetHostName()
        {
            NameResolutionPal.EnsureSocketsAreInitialized();

            string name = NameResolutionPal.GetHostName();

            if (NetEventSource.IsEnabled)
            {
                NetEventSource.Info(null, name);
            }
            return(name);
        }
예제 #6
0
파일: Dns.cs 프로젝트: naricc/runtime
        /// <summary>Gets the host name of the local machine.</summary>
        public static string GetHostName()
        {
            long startingTimestamp = NameResolutionTelemetry.Log.BeforeResolution(string.Empty);

            string name;

            try
            {
                name = NameResolutionPal.GetHostName();
            }
            catch when(LogFailure(startingTimestamp))
            {
                Debug.Fail("LogFailure should return false");
                throw;
            }

            NameResolutionTelemetry.Log.AfterResolution(startingTimestamp, successful: true);

            if (NetEventSource.Log.IsEnabled())
            {
                NetEventSource.Info(null, name);
            }
            return(name);
        }
예제 #7
0
파일: DNS.cs 프로젝트: thiagodin/corefx
        } // InternalGetHostByAddress

        /*****************************************************************************
         * Function :    gethostname
         *
         * Abstract:     Queries the hostname from DNS
         *
         * Input Parameters:
         *
         * Returns: String
         ******************************************************************************/

        /// <devdoc>
        ///    <para>Gets the host name of the local machine.</para>
        /// </devdoc>
        public static string GetHostName()
        {
            GlobalLog.Print("Dns.GetHostName");
            return(NameResolutionPal.GetHostName());
        }