System.Net.ServicePointManager.SetTcpKeepAlive C# (CSharp) Method

SetTcpKeepAlive() public static method

public static SetTcpKeepAlive ( bool enabled, int keepAliveTime, int keepAliveInterval ) : void
enabled bool
keepAliveTime int
keepAliveInterval int
return void
        public static void SetTcpKeepAlive(bool enabled, int keepAliveTime, int keepAliveInterval) { throw null; }
    }

Usage Example

示例#1
0
        static HttpClient()
        {
#if !Mono
            //返回域名多IP地址
            ServicePointManager.EnableDnsRoundRobin = true;
#endif
            ServicePointManager.DefaultConnectionLimit  = ushort.MaxValue;
            ServicePointManager.MaxServicePoints        = 0;
            ServicePointManager.MaxServicePointIdleTime = 100000;
            checked
            {
                int keep = (int)xHttpHandler.KeepAliveInterval;
                ServicePointManager.SetTcpKeepAlive(true, keep, keep);
            }
            ServicePointManager.CheckCertificateRevocationList      = true;
            ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult);
        }