| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent eab5be7 commit 9fe246c
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | 3 | <PropertyGroup> | |
| 4 | 4 | <TargetFramework>net6.0</TargetFramework> | |
| 5 | - <Version>6.5.0.0</Version> | ||
| 5 | + <Version>6.6.0.0</Version> | ||
| 6 | 6 | <Authors>Ivan Shynkarenka</Authors> | |
| 7 | 7 | <Copyright>Copyright (c) 2019-2022 Ivan Shynkarenka</Copyright> | |
| 8 | 8 | <RepositoryUrl>https://github.com/chronoxor/NetCoreServer</RepositoryUrl> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -115,6 +115,27 @@ private SslClient(SslContext context, EndPoint endpoint, string address, int por | |||
| 115 | 115 | /// </remarks> | |
| 116 | 116 | public bool OptionKeepAlive { get; set; } | |
| 117 | 117 | /// <summary> | |
| 118 | + /// Option: TCP keep alive time | ||
| 119 | + /// </summary> | ||
| 120 | + /// <remarks> | ||
| 121 | + /// The number of seconds a TCP connection will remain alive/idle before keepalive probes are sent to the remote | ||
| 122 | + /// </remarks> | ||
| 123 | + public int OptionTcpKeepAliveTime { get; set; } = -1; | ||
| 124 | + /// <summary> | ||
| 125 | + /// Option: TCP keep alive interval | ||
| 126 | + /// </summary> | ||
| 127 | + /// <remarks> | ||
| 128 | + /// The number of seconds a TCP connection will wait for a keepalive response before sending another keepalive probe | ||
| 129 | + /// </remarks> | ||
| 130 | + public int OptionTcpKeepAliveInterval { get; set; } = -1; | ||
| 131 | + /// <summary> | ||
| 132 | + /// Option: TCP keep alive retry count | ||
| 133 | + /// </summary> | ||
| 134 | + /// <remarks> | ||
| 135 | + /// The number of TCP keep alive probes that will be sent before the connection is terminated | ||
| 136 | + /// </remarks> | ||
| 137 | + public int OptionTcpKeepAliveRetryCount { get; set; } = -1; | ||
| 138 | + /// <summary> | ||
| 118 | 139 | /// Option: no delay | |
| 119 | 140 | /// </summary> | |
| 120 | 141 | /// <remarks> | |
@@ -244,6 +265,12 @@ public virtual bool Connect() | |||
| 244 | 265 | // Apply the option: keep alive | |
| 245 | 266 | if (OptionKeepAlive) | |
| 246 | 267 | Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true); | |
| 268 | + if (OptionTcpKeepAliveTime >= 0) | ||
| 269 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, OptionTcpKeepAliveTime); | ||
| 270 | + if (OptionTcpKeepAliveInterval >= 0) | ||
| 271 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveInterval, OptionTcpKeepAliveInterval); | ||
| 272 | + if (OptionTcpKeepAliveRetryCount >= 0) | ||
| 273 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveRetryCount, OptionTcpKeepAliveRetryCount); | ||
| 247 | 274 | // Apply the option: no delay | |
| 248 | 275 | if (OptionNoDelay) | |
| 249 | 276 | Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true); | |
@@ -813,6 +840,12 @@ private void ProcessConnect(SocketAsyncEventArgs e) | |||
| 813 | 840 | // Apply the option: keep alive | |
| 814 | 841 | if (OptionKeepAlive) | |
| 815 | 842 | Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true); | |
| 843 | + if (OptionTcpKeepAliveTime >= 0) | ||
| 844 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, OptionTcpKeepAliveTime); | ||
| 845 | + if (OptionTcpKeepAliveInterval >= 0) | ||
| 846 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveInterval, OptionTcpKeepAliveInterval); | ||
| 847 | + if (OptionTcpKeepAliveRetryCount >= 0) | ||
| 848 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveRetryCount, OptionTcpKeepAliveRetryCount); | ||
| 816 | 849 | // Apply the option: no delay | |
| 817 | 850 | if (OptionNoDelay) | |
| 818 | 851 | Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -118,6 +118,27 @@ private SslServer(SslContext context, EndPoint endpoint, string address, int por | |||
| 118 | 118 | /// </remarks> | |
| 119 | 119 | public bool OptionKeepAlive { get; set; } | |
| 120 | 120 | /// <summary> | |
| 121 | + /// Option: TCP keep alive time | ||
| 122 | + /// </summary> | ||
| 123 | + /// <remarks> | ||
| 124 | + /// The number of seconds a TCP connection will remain alive/idle before keepalive probes are sent to the remote | ||
| 125 | + /// </remarks> | ||
| 126 | + public int OptionTcpKeepAliveTime { get; set; } = -1; | ||
| 127 | + /// <summary> | ||
| 128 | + /// Option: TCP keep alive interval | ||
| 129 | + /// </summary> | ||
| 130 | + /// <remarks> | ||
| 131 | + /// The number of seconds a TCP connection will wait for a keepalive response before sending another keepalive probe | ||
| 132 | + /// </remarks> | ||
| 133 | + public int OptionTcpKeepAliveInterval { get; set; } = -1; | ||
| 134 | + /// <summary> | ||
| 135 | + /// Option: TCP keep alive retry count | ||
| 136 | + /// </summary> | ||
| 137 | + /// <remarks> | ||
| 138 | + /// The number of TCP keep alive probes that will be sent before the connection is terminated | ||
| 139 | + /// </remarks> | ||
| 140 | + public int OptionTcpKeepAliveRetryCount { get; set; } = -1; | ||
| 141 | + /// <summary> | ||
| 121 | 142 | /// Option: no delay | |
| 122 | 143 | /// </summary> | |
| 123 | 144 | /// <remarks> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -106,6 +106,12 @@ internal void Connect(Socket socket) | |||
| 106 | 106 | // Apply the option: keep alive | |
| 107 | 107 | if (Server.OptionKeepAlive) | |
| 108 | 108 | Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true); | |
| 109 | + if (Server.OptionTcpKeepAliveTime >= 0) | ||
| 110 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, Server.OptionTcpKeepAliveTime); | ||
| 111 | + if (Server.OptionTcpKeepAliveInterval >= 0) | ||
| 112 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveInterval, Server.OptionTcpKeepAliveInterval); | ||
| 113 | + if (Server.OptionTcpKeepAliveRetryCount >= 0) | ||
| 114 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveRetryCount, Server.OptionTcpKeepAliveRetryCount); | ||
| 109 | 115 | // Apply the option: no delay | |
| 110 | 116 | if (Server.OptionNoDelay) | |
| 111 | 117 | Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -103,6 +103,27 @@ private TcpClient(EndPoint endpoint, string address, int port) | |||
| 103 | 103 | /// </remarks> | |
| 104 | 104 | public bool OptionKeepAlive { get; set; } | |
| 105 | 105 | /// <summary> | |
| 106 | + /// Option: TCP keep alive time | ||
| 107 | + /// </summary> | ||
| 108 | + /// <remarks> | ||
| 109 | + /// The number of seconds a TCP connection will remain alive/idle before keepalive probes are sent to the remote | ||
| 110 | + /// </remarks> | ||
| 111 | + public int OptionTcpKeepAliveTime { get; set; } = -1; | ||
| 112 | + /// <summary> | ||
| 113 | + /// Option: TCP keep alive interval | ||
| 114 | + /// </summary> | ||
| 115 | + /// <remarks> | ||
| 116 | + /// The number of seconds a TCP connection will wait for a keepalive response before sending another keepalive probe | ||
| 117 | + /// </remarks> | ||
| 118 | + public int OptionTcpKeepAliveInterval { get; set; } = -1; | ||
| 119 | + /// <summary> | ||
| 120 | + /// Option: TCP keep alive retry count | ||
| 121 | + /// </summary> | ||
| 122 | + /// <remarks> | ||
| 123 | + /// The number of TCP keep alive probes that will be sent before the connection is terminated | ||
| 124 | + /// </remarks> | ||
| 125 | + public int OptionTcpKeepAliveRetryCount { get; set; } = -1; | ||
| 126 | + /// <summary> | ||
| 106 | 127 | /// Option: no delay | |
| 107 | 128 | /// </summary> | |
| 108 | 129 | /// <remarks> | |
@@ -229,6 +250,12 @@ public virtual bool Connect() | |||
| 229 | 250 | // Apply the option: keep alive | |
| 230 | 251 | if (OptionKeepAlive) | |
| 231 | 252 | Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true); | |
| 253 | + if (OptionTcpKeepAliveTime >= 0) | ||
| 254 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, OptionTcpKeepAliveTime); | ||
| 255 | + if (OptionTcpKeepAliveInterval >= 0) | ||
| 256 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveInterval, OptionTcpKeepAliveInterval); | ||
| 257 | + if (OptionTcpKeepAliveRetryCount >= 0) | ||
| 258 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveRetryCount, OptionTcpKeepAliveRetryCount); | ||
| 232 | 259 | // Apply the option: no delay | |
| 233 | 260 | if (OptionNoDelay) | |
| 234 | 261 | Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true); | |
@@ -764,6 +791,12 @@ private void ProcessConnect(SocketAsyncEventArgs e) | |||
| 764 | 791 | // Apply the option: keep alive | |
| 765 | 792 | if (OptionKeepAlive) | |
| 766 | 793 | Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true); | |
| 794 | + if (OptionTcpKeepAliveTime >= 0) | ||
| 795 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, OptionTcpKeepAliveTime); | ||
| 796 | + if (OptionTcpKeepAliveInterval >= 0) | ||
| 797 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveInterval, OptionTcpKeepAliveInterval); | ||
| 798 | + if (OptionTcpKeepAliveRetryCount >= 0) | ||
| 799 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveRetryCount, OptionTcpKeepAliveRetryCount); | ||
| 767 | 800 | // Apply the option: no delay | |
| 768 | 801 | if (OptionNoDelay) | |
| 769 | 802 | Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -108,6 +108,27 @@ private TcpServer(EndPoint endpoint, string address, int port) | |||
| 108 | 108 | /// </remarks> | |
| 109 | 109 | public bool OptionKeepAlive { get; set; } | |
| 110 | 110 | /// <summary> | |
| 111 | + /// Option: TCP keep alive time | ||
| 112 | + /// </summary> | ||
| 113 | + /// <remarks> | ||
| 114 | + /// The number of seconds a TCP connection will remain alive/idle before keepalive probes are sent to the remote | ||
| 115 | + /// </remarks> | ||
| 116 | + public int OptionTcpKeepAliveTime { get; set; } = -1; | ||
| 117 | + /// <summary> | ||
| 118 | + /// Option: TCP keep alive interval | ||
| 119 | + /// </summary> | ||
| 120 | + /// <remarks> | ||
| 121 | + /// The number of seconds a TCP connection will wait for a keepalive response before sending another keepalive probe | ||
| 122 | + /// </remarks> | ||
| 123 | + public int OptionTcpKeepAliveInterval { get; set; } = -1; | ||
| 124 | + /// <summary> | ||
| 125 | + /// Option: TCP keep alive retry count | ||
| 126 | + /// </summary> | ||
| 127 | + /// <remarks> | ||
| 128 | + /// The number of TCP keep alive probes that will be sent before the connection is terminated | ||
| 129 | + /// </remarks> | ||
| 130 | + public int OptionTcpKeepAliveRetryCount { get; set; } = -1; | ||
| 131 | + /// <summary> | ||
| 111 | 132 | /// Option: no delay | |
| 112 | 133 | /// </summary> | |
| 113 | 134 | /// <remarks> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -103,6 +103,12 @@ internal void Connect(Socket socket) | |||
| 103 | 103 | // Apply the option: keep alive | |
| 104 | 104 | if (Server.OptionKeepAlive) | |
| 105 | 105 | Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true); | |
| 106 | + if (Server.OptionTcpKeepAliveTime >= 0) | ||
| 107 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, Server.OptionTcpKeepAliveTime); | ||
| 108 | + if (Server.OptionTcpKeepAliveInterval >= 0) | ||
| 109 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveInterval, Server.OptionTcpKeepAliveInterval); | ||
| 110 | + if (Server.OptionTcpKeepAliveRetryCount >= 0) | ||
| 111 | + Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveRetryCount, Server.OptionTcpKeepAliveRetryCount); | ||
| 106 | 112 | // Apply the option: no delay | |
| 107 | 113 | if (Server.OptionNoDelay) | |
| 108 | 114 | Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, true); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments