make main methods async

pull/24530/head
Moien Tajik 4 years ago
parent 04f6f3676e
commit 3054749cab
  1. 15
      src/csharp/Grpc.Examples.MathClient/MathClient.cs
  2. 5
      src/csharp/Grpc.Examples.MathServer/MathServer.cs

@ -16,29 +16,30 @@
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
namespace Math
{
class MathClient
{
public static void Main(string[] args)
public static async Task Main(string[] args)
{
var channel = new Channel("127.0.0.1", 23456, ChannelCredentials.Insecure);
Math.MathClient client = new Math.MathClient(channel);
MathExamples.DivExample(client);
MathExamples.DivAsyncExample(client).Wait();
await MathExamples.DivAsyncExample(client);
MathExamples.FibExample(client).Wait();
await MathExamples.FibExample(client);
MathExamples.SumExample(client).Wait();
await MathExamples.SumExample(client);
MathExamples.DivManyExample(client).Wait();
await MathExamples.DivManyExample(client);
MathExamples.DependendRequestsExample(client).Wait();
await MathExamples.DependendRequestsExample(client);
channel.ShutdownAsync().Wait();
await channel.ShutdownAsync();
}
}
}

@ -17,6 +17,7 @@
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Grpc.Core;
namespace Math
@ -26,7 +27,7 @@ namespace Math
const string Host = "0.0.0.0";
const int Port = 23456;
public static void Main(string[] args)
public static async Task Main(string[] args)
{
Server server = new Server
{
@ -40,7 +41,7 @@ namespace Math
Console.WriteLine("Press any key to stop the server...");
Console.ReadKey();
server.ShutdownAsync().Wait();
await server.ShutdownAsync();
}
}
}

Loading…
Cancel
Save