| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fea66f9 commit 2312a1d
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | # Specify version format | |
| 2 | - version: "3.0.20.{build}" | ||
| 2 | + version: "3.0.21.{build}" | ||
| 3 | 3 | ||
| 4 | 4 | # Image to use | |
| 5 | 5 | image: Visual Studio 2019 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | 3 | <PropertyGroup> | |
| 4 | 4 | <TargetFramework>netstandard2.1</TargetFramework> | |
| 5 | - <Version>3.0.20</Version> | ||
| 5 | + <Version>3.0.21</Version> | ||
| 6 | 6 | <Authors>Ivan Shynkarenka</Authors> | |
| 7 | 7 | <Copyright>Copyright (c) 2019-2020 Ivan Shynkarenka</Copyright> | |
| 8 | 8 | <RepositoryUrl>https://github.com/chronoxor/NetCoreServer</RepositoryUrl> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -136,6 +136,18 @@ public SslClient(SslContext context, IPEndPoint endpoint) | |||
| 136 | 136 | /// </summary> | |
| 137 | 137 | public bool IsHandshaked { get; private set; } | |
| 138 | 138 | ||
| 139 | + /// <summary> | ||
| 140 | + /// Create a new socket object | ||
| 141 | + /// </summary> | ||
| 142 | + /// <remarks> | ||
| 143 | + /// Method may be override if you need to prepare some specific socket object in your implementation. | ||
| 144 | + /// </remarks> | ||
| 145 | + /// <returns>Socket object</returns> | ||
| 146 | + protected virtual Socket CreateSocket() | ||
| 147 | + { | ||
| 148 | + return new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); | ||
| 149 | + } | ||
| 150 | + | ||
| 139 | 151 | /// <summary> | |
| 140 | 152 | /// Connect the client (synchronous) | |
| 141 | 153 | /// </summary> | |
@@ -160,7 +172,7 @@ public virtual bool Connect() | |||
| 160 | 172 | _connectEventArg.Completed += OnAsyncCompleted; | |
| 161 | 173 | ||
| 162 | 174 | // Create a new client socket | |
| 163 | - Socket = new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); | ||
| 175 | + Socket = CreateSocket(); | ||
| 164 | 176 | ||
| 165 | 177 | // Apply the option: dual mode (this option must be applied before connecting) | |
| 166 | 178 | if (Socket.AddressFamily == AddressFamily.InterNetworkV6) | |
@@ -356,7 +368,7 @@ public virtual bool ConnectAsync() | |||
| 356 | 368 | _connectEventArg.Completed += OnAsyncCompleted; | |
| 357 | 369 | ||
| 358 | 370 | // Create a new client socket | |
| 359 | - Socket = new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); | ||
| 371 | + Socket = CreateSocket(); | ||
| 360 | 372 | ||
| 361 | 373 | // Apply the option: dual mode (this option must be applied before connecting) | |
| 362 | 374 | if (Socket.AddressFamily == AddressFamily.InterNetworkV6) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -144,6 +144,18 @@ public SslServer(SslContext context, IPEndPoint endpoint) | |||
| 144 | 144 | /// </summary> | |
| 145 | 145 | public bool IsAccepting { get; private set; } | |
| 146 | 146 | ||
| 147 | + /// <summary> | ||
| 148 | + /// Create a new socket object | ||
| 149 | + /// </summary> | ||
| 150 | + /// <remarks> | ||
| 151 | + /// Method may be override if you need to prepare some specific socket object in your implementation. | ||
| 152 | + /// </remarks> | ||
| 153 | + /// <returns>Socket object</returns> | ||
| 154 | + protected virtual Socket CreateSocket() | ||
| 155 | + { | ||
| 156 | + return new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); | ||
| 157 | + } | ||
| 158 | + | ||
| 147 | 159 | /// <summary> | |
| 148 | 160 | /// Start the server | |
| 149 | 161 | /// </summary> | |
@@ -159,7 +171,7 @@ public virtual bool Start() | |||
| 159 | 171 | _acceptorEventArg.Completed += OnAsyncCompleted; | |
| 160 | 172 | ||
| 161 | 173 | // Create a new acceptor socket | |
| 162 | - _acceptorSocket = new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); | ||
| 174 | + _acceptorSocket = CreateSocket(); | ||
| 163 | 175 | ||
| 164 | 176 | // Update the acceptor socket disposed flag | |
| 165 | 177 | IsSocketDisposed = false; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -110,6 +110,18 @@ public TcpClient(IPEndPoint endpoint) | |||
| 110 | 110 | /// </summary> | |
| 111 | 111 | public bool IsConnected { get; private set; } | |
| 112 | 112 | ||
| 113 | + /// <summary> | ||
| 114 | + /// Create a new socket object | ||
| 115 | + /// </summary> | ||
| 116 | + /// <remarks> | ||
| 117 | + /// Method may be override if you need to prepare some specific socket object in your implementation. | ||
| 118 | + /// </remarks> | ||
| 119 | + /// <returns>Socket object</returns> | ||
| 120 | + protected virtual Socket CreateSocket() | ||
| 121 | + { | ||
| 122 | + return new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); | ||
| 123 | + } | ||
| 124 | + | ||
| 113 | 125 | /// <summary> | |
| 114 | 126 | /// Connect the client (synchronous) | |
| 115 | 127 | /// </summary> | |
@@ -138,7 +150,7 @@ public virtual bool Connect() | |||
| 138 | 150 | _sendEventArg.Completed += OnAsyncCompleted; | |
| 139 | 151 | ||
| 140 | 152 | // Create a new client socket | |
| 141 | - Socket = new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); | ||
| 153 | + Socket = CreateSocket(); | ||
| 142 | 154 | ||
| 143 | 155 | // Apply the option: dual mode (this option must be applied before connecting) | |
| 144 | 156 | if (Socket.AddressFamily == AddressFamily.InterNetworkV6) | |
@@ -295,7 +307,7 @@ public virtual bool ConnectAsync() | |||
| 295 | 307 | _sendEventArg.Completed += OnAsyncCompleted; | |
| 296 | 308 | ||
| 297 | 309 | // Create a new client socket | |
| 298 | - Socket = new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); | ||
| 310 | + Socket = CreateSocket(); | ||
| 299 | 311 | ||
| 300 | 312 | // Apply the option: dual mode (this option must be applied before connecting) | |
| 301 | 313 | if (Socket.AddressFamily == AddressFamily.InterNetworkV6) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -135,6 +135,18 @@ public TcpServer(IPEndPoint endpoint) | |||
| 135 | 135 | /// </summary> | |
| 136 | 136 | public bool IsAccepting { get; private set; } | |
| 137 | 137 | ||
| 138 | + /// <summary> | ||
| 139 | + /// Create a new socket object | ||
| 140 | + /// </summary> | ||
| 141 | + /// <remarks> | ||
| 142 | + /// Method may be override if you need to prepare some specific socket object in your implementation. | ||
| 143 | + /// </remarks> | ||
| 144 | + /// <returns>Socket object</returns> | ||
| 145 | + protected virtual Socket CreateSocket() | ||
| 146 | + { | ||
| 147 | + return new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); | ||
| 148 | + } | ||
| 149 | + | ||
| 138 | 150 | /// <summary> | |
| 139 | 151 | /// Start the server | |
| 140 | 152 | /// </summary> | |
@@ -150,7 +162,7 @@ public virtual bool Start() | |||
| 150 | 162 | _acceptorEventArg.Completed += OnAsyncCompleted; | |
| 151 | 163 | ||
| 152 | 164 | // Create a new acceptor socket | |
| 153 | - _acceptorSocket = new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); | ||
| 165 | + _acceptorSocket = CreateSocket(); | ||
| 154 | 166 | ||
| 155 | 167 | // Update the acceptor socket disposed flag | |
| 156 | 168 | IsSocketDisposed = false; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -115,6 +115,18 @@ public UdpClient(IPEndPoint endpoint) | |||
| 115 | 115 | /// </summary> | |
| 116 | 116 | public bool IsConnected { get; private set; } | |
| 117 | 117 | ||
| 118 | + /// <summary> | ||
| 119 | + /// Create a new socket object | ||
| 120 | + /// </summary> | ||
| 121 | + /// <remarks> | ||
| 122 | + /// Method may be override if you need to prepare some specific socket object in your implementation. | ||
| 123 | + /// </remarks> | ||
| 124 | + /// <returns>Socket object</returns> | ||
| 125 | + protected virtual Socket CreateSocket() | ||
| 126 | + { | ||
| 127 | + return new Socket(Endpoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp); | ||
| 128 | + } | ||
| 129 | + | ||
| 118 | 130 | /// <summary> | |
| 119 | 131 | /// Connect the client (synchronous) | |
| 120 | 132 | /// </summary> | |
@@ -135,7 +147,7 @@ public virtual bool Connect() | |||
| 135 | 147 | _sendEventArg.Completed += OnAsyncCompleted; | |
| 136 | 148 | ||
| 137 | 149 | // Create a new client socket | |
| 138 | - Socket = new Socket(Endpoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp); | ||
| 150 | + Socket = CreateSocket(); | ||
| 139 | 151 | ||
| 140 | 152 | // Update the client socket disposed flag | |
| 141 | 153 | IsSocketDisposed = false; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -116,6 +116,18 @@ public UdpServer(IPEndPoint endpoint) | |||
| 116 | 116 | /// </summary> | |
| 117 | 117 | public bool IsStarted { get; private set; } | |
| 118 | 118 | ||
| 119 | + /// <summary> | ||
| 120 | + /// Create a new socket object | ||
| 121 | + /// </summary> | ||
| 122 | + /// <remarks> | ||
| 123 | + /// Method may be override if you need to prepare some specific socket object in your implementation. | ||
| 124 | + /// </remarks> | ||
| 125 | + /// <returns>Socket object</returns> | ||
| 126 | + protected virtual Socket CreateSocket() | ||
| 127 | + { | ||
| 128 | + return new Socket(Endpoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp); | ||
| 129 | + } | ||
| 130 | + | ||
| 119 | 131 | /// <summary> | |
| 120 | 132 | /// Start the server (synchronous) | |
| 121 | 133 | /// </summary> | |
@@ -137,7 +149,7 @@ public virtual bool Start() | |||
| 137 | 149 | _sendEventArg.Completed += OnAsyncCompleted; | |
| 138 | 150 | ||
| 139 | 151 | // Create a new server socket | |
| 140 | - Socket = new Socket(Endpoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp); | ||
| 152 | + Socket = CreateSocket(); | ||
| 141 | 153 | ||
| 142 | 154 | // Update the server socket disposed flag | |
| 143 | 155 | IsSocketDisposed = false; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments