File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public partial class Plc
25
25
/// <returns>A task that represents the asynchronous open operation.</returns>
26
26
public async Task OpenAsync ( CancellationToken cancellationToken = default )
27
27
{
28
- var stream = await ConnectAsync ( ) . ConfigureAwait ( false ) ;
28
+ var stream = await ConnectAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
29
29
try
30
30
{
31
31
await queue . Enqueue ( async ( ) =>
@@ -44,11 +44,16 @@ await queue.Enqueue(async () =>
44
44
}
45
45
}
46
46
47
- private async Task < NetworkStream > ConnectAsync ( )
47
+ private async Task < NetworkStream > ConnectAsync ( CancellationToken cancellationToken )
48
48
{
49
49
tcpClient = new TcpClient ( ) ;
50
50
ConfigureConnection ( ) ;
51
+
52
+ #if NET5_0_OR_GREATER
53
+ await tcpClient . ConnectAsync ( IP , Port , cancellationToken ) . ConfigureAwait ( false ) ;
54
+ #else
51
55
await tcpClient . ConnectAsync ( IP , Port ) . ConfigureAwait ( false ) ;
56
+ #endif
52
57
return tcpClient . GetStream ( ) ;
53
58
}
54
59
Original file line number Diff line number Diff line change 1
1
<Project Sdk =" Microsoft.NET.Sdk" >
2
2
3
3
<PropertyGroup >
4
- <TargetFrameworks >net452;netstandard2.0;netstandard1.3</TargetFrameworks >
4
+ <TargetFrameworks >net452;netstandard2.0;netstandard1.3;net5.0 </TargetFrameworks >
5
5
<SignAssembly >true</SignAssembly >
6
6
<AssemblyOriginatorKeyFile >Properties\S7.Net.snk</AssemblyOriginatorKeyFile >
7
7
<InternalsVisibleTo >S7.Net.UnitTest</InternalsVisibleTo >
Original file line number Diff line number Diff line change 1
- image : Visual Studio 2019
1
+ image : Visual Studio 2022
2
2
configuration : Release
3
3
install :
4
4
- choco install gitversion.portable -y
You can’t perform that action at this time.
0 commit comments