public TcpSocketClientConfiguration(ISegmentBufferManager bufferManager)
        {
            BufferManager = bufferManager;

            ReceiveBufferSize = 8192;                       // Specifies the total per-socket buffer space reserved for receives. This is unrelated to the maximum message size or the size of a TCP window.
            SendBufferSize    = 8192;                       // Specifies the total per-socket buffer space reserved for sends. This is unrelated to the maximum message size or the size of a TCP window.
            ReceiveTimeout    = TimeSpan.Zero;              // Receive a time-out. This option applies only to synchronous methods; it has no effect on asynchronous methods such as the BeginSend method.
            SendTimeout       = TimeSpan.Zero;              // Send a time-out. This option applies only to synchronous methods; it has no effect on asynchronous methods such as the BeginSend method.
            NoDelay           = true;                       // Disables the Nagle algorithm for send coalescing.
            LingerState       = new LingerOption(false, 0); // The socket will linger for x seconds after Socket.Close is called.
            KeepAlive         = false;                      // Use keep-alives.
            KeepAliveInterval = TimeSpan.FromSeconds(5);    // https://msdn.microsoft.com/en-us/library/system.net.sockets.socketoptionname(v=vs.110).aspx
            ReuseAddress      = false;                      // Allows the socket to be bound to an address that is already in use.

            SslEnabled                    = false;
            SslTargetHost                 = null;
            SslClientCertificates         = new X509CertificateCollection();
            SslEncryptionPolicy           = EncryptionPolicy.RequireEncryption;
            SslEnabledProtocols           = SslProtocols.Ssl3 | SslProtocols.Tls;
            SslCheckCertificateRevocation = false;
            SslPolicyErrorsBypassed       = false;

            ConnectTimeout = TimeSpan.FromSeconds(15);
            FrameBuilder   = new LengthPrefixedFrameBuilder();
        }
예제 #2
0
        public AsyncTcpSocketServerConfiguration(ISegmentBufferManager bufferManager)
        {
            BufferManager = bufferManager;

            ReceiveBufferSize = 8192;
            SendBufferSize    = 8192;
            ReceiveTimeout    = TimeSpan.Zero;
            SendTimeout       = TimeSpan.Zero;
            NoDelay           = true;
            LingerState       = new LingerOption(false, 0);
            KeepAlive         = false;
            KeepAliveInterval = TimeSpan.FromSeconds(5);
            ReuseAddress      = false;

            PendingConnectionBacklog = 200;
            AllowNatTraversal        = true;

            SslEnabled                    = false;
            SslServerCertificate          = null;
            SslEncryptionPolicy           = EncryptionPolicy.RequireEncryption;
            SslEnabledProtocols           = SslProtocols.Ssl3 | SslProtocols.Tls;
            SslClientCertificateRequired  = true;
            SslCheckCertificateRevocation = false;
            SslPolicyErrorsBypassed       = false;

            ConnectTimeout = TimeSpan.FromSeconds(15);
            FrameBuilder   = new LengthPrefixedFrameBuilder();
        }