File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -72,6 +72,13 @@ public SslServer(SslContext context, IPEndPoint endpoint)
7272 /// </summary>
7373 public long BytesReceived { get { return _bytesReceived ; } }
7474
75+ /// <summary>
76+ /// Option: acceptor backlog size
77+ /// </summary>
78+ /// <remarks>
79+ /// This option will set the listening socket's backlog size
80+ /// </remarks>
81+ public int OptionAcceptorBacklog { get ; set ; } = 1024 ;
7582 /// <summary>
7683 /// Option: keep alive
7784 /// </summary>
@@ -104,7 +111,6 @@ public SslServer(SslContext context, IPEndPoint endpoint)
104111 #region Start/Stop server
105112
106113 // Server acceptor
107- private int _acceptorBacklog = 1024 ;
108114 private Socket _acceptorSocket ;
109115 private SocketAsyncEventArgs _acceptorEventArg ;
110116
@@ -153,7 +159,7 @@ public virtual bool Start()
153159 // Refresh the endpoint property based on the actual endpoint created
154160 Endpoint = ( IPEndPoint ) _acceptorSocket . LocalEndPoint ;
155161 // Start listen to the acceptor socket with the given accepting backlog size
156- _acceptorSocket . Listen ( _acceptorBacklog ) ;
162+ _acceptorSocket . Listen ( OptionAcceptorBacklog ) ;
157163
158164 // Reset statistic
159165 _bytesPending = 0 ;
Original file line number Diff line number Diff line change 11using System ;
2+ using System . IO ;
23using System . Net . Security ;
34using System . Net . Sockets ;
45using System . Text ;
@@ -158,8 +159,13 @@ public virtual bool Disconnect()
158159
159160 try
160161 {
161- // Shutdown the SSL stream
162- _sslStream . ShutdownAsync ( ) . Wait ( ) ;
162+ try
163+ {
164+ // Shutdown the SSL stream
165+ _sslStream . ShutdownAsync ( ) . Wait ( ) ;
166+ }
167+ catch ( AggregateException ) { }
168+ catch ( IOException ) { }
163169
164170 // Dispose the SSL stream & buffer
165171 _sslStream . Dispose ( ) ;
Original file line number Diff line number Diff line change @@ -63,6 +63,13 @@ public TcpServer(IPEndPoint endpoint)
6363 /// </summary>
6464 public long BytesReceived { get { return _bytesReceived ; } }
6565
66+ /// <summary>
67+ /// Option: acceptor backlog size
68+ /// </summary>
69+ /// <remarks>
70+ /// This option will set the listening socket's backlog size
71+ /// </remarks>
72+ public int OptionAcceptorBacklog { get ; set ; } = 1024 ;
6673 /// <summary>
6774 /// Option: keep alive
6875 /// </summary>
@@ -95,7 +102,6 @@ public TcpServer(IPEndPoint endpoint)
95102 #region Start/Stop server
96103
97104 // Server acceptor
98- private int _acceptorBacklog = 1024 ;
99105 private Socket _acceptorSocket ;
100106 private SocketAsyncEventArgs _acceptorEventArg ;
101107
@@ -144,7 +150,7 @@ public virtual bool Start()
144150 // Refresh the endpoint property based on the actual endpoint created
145151 Endpoint = ( IPEndPoint ) _acceptorSocket . LocalEndPoint ;
146152 // Start listen to the acceptor socket with the given accepting backlog size
147- _acceptorSocket . Listen ( _acceptorBacklog ) ;
153+ _acceptorSocket . Listen ( OptionAcceptorBacklog ) ;
148154
149155 // Reset statistic
150156 _bytesPending = 0 ;
You can’t perform that action at this time.
0 commit comments