File tree Expand file tree Collapse file tree 4 files changed +13
-17
lines changed Expand file tree Collapse file tree 4 files changed +13
-17
lines changed Original file line number Diff line number Diff line change 13
13
// See the License for the specific language governing permissions and
14
14
// limitations under the License.
15
15
#endregion
16
- using System ;
17
- using System . Runtime . InteropServices ;
18
- using System . Threading ;
16
+ using System . Threading . Tasks ;
19
17
using Grpc . Core ;
20
18
21
19
namespace Math
22
20
{
23
21
class MathClient
24
22
{
25
- public static void Main ( string [ ] args )
23
+ public static async Task Main ( string [ ] args )
26
24
{
27
25
var channel = new Channel ( "127.0.0.1" , 23456 , ChannelCredentials . Insecure ) ;
28
26
Math . MathClient client = new Math . MathClient ( channel ) ;
29
27
MathExamples . DivExample ( client ) ;
30
28
31
- MathExamples . DivAsyncExample ( client ) . Wait ( ) ;
29
+ await MathExamples . DivAsyncExample ( client ) ;
32
30
33
- MathExamples . FibExample ( client ) . Wait ( ) ;
31
+ await MathExamples . FibExample ( client ) ;
34
32
35
- MathExamples . SumExample ( client ) . Wait ( ) ;
33
+ await MathExamples . SumExample ( client ) ;
36
34
37
- MathExamples . DivManyExample ( client ) . Wait ( ) ;
35
+ await MathExamples . DivManyExample ( client ) ;
38
36
39
- MathExamples . DependendRequestsExample ( client ) . Wait ( ) ;
37
+ await MathExamples . DependentRequestsExample ( client ) ;
40
38
41
- channel . ShutdownAsync ( ) . Wait ( ) ;
39
+ await channel . ShutdownAsync ( ) ;
42
40
}
43
41
}
44
42
}
Original file line number Diff line number Diff line change 15
15
#endregion
16
16
17
17
using System ;
18
- using System . Runtime . InteropServices ;
19
- using System . Threading ;
18
+ using System . Threading . Tasks ;
20
19
using Grpc . Core ;
21
20
22
21
namespace Math
@@ -26,7 +25,7 @@ class MainClass
26
25
const string Host = "0.0.0.0" ;
27
26
const int Port = 23456 ;
28
27
29
- public static void Main ( string [ ] args )
28
+ public static async Task Main ( string [ ] args )
30
29
{
31
30
Server server = new Server
32
31
{
@@ -40,7 +39,7 @@ public static void Main(string[] args)
40
39
Console . WriteLine ( "Press any key to stop the server..." ) ;
41
40
Console . ReadKey ( ) ;
42
41
43
- server . ShutdownAsync ( ) . Wait ( ) ;
42
+ await server . ShutdownAsync ( ) ;
44
43
}
45
44
}
46
45
}
Original file line number Diff line number Diff line change @@ -69,14 +69,15 @@ public static async Task DivManyExample(Math.MathClient client)
69
69
new DivArgs { Dividend = 100 , Divisor = 21 } ,
70
70
new DivArgs { Dividend = 7 , Divisor = 2 }
71
71
} ;
72
+
72
73
using ( var call = client . DivMany ( ) )
73
74
{
74
75
await call . RequestStream . WriteAllAsync ( divArgsList ) ;
75
76
Console . WriteLine ( "DivMany Result: " + string . Join ( "|" , await call . ResponseStream . ToListAsync ( ) ) ) ;
76
77
}
77
78
}
78
79
79
- public static async Task DependendRequestsExample ( Math . MathClient client )
80
+ public static async Task DependentRequestsExample ( Math . MathClient client )
80
81
{
81
82
var numbers = new List < Num >
82
83
{
Original file line number Diff line number Diff line change 16
16
17
17
#endregion
18
18
19
- using System ;
20
19
using System . Collections . Generic ;
21
- using System . Threading ;
22
20
using System . Threading . Tasks ;
23
21
using Grpc . Core ;
24
22
using Grpc . Core . Utils ;
You can’t perform that action at this time.
0 commit comments