aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Examples.MathServer
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2015-08-04 22:02:55 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2015-08-04 22:02:55 -0700
commit31ba0632247993b02b552294691a354ee5d0ef08 (patch)
tree47063b83bf3d9fcf04ee66a87afe3198a16de378 /src/csharp/Grpc.Examples.MathServer
parent021df8a7f23c00216d1a544b34d4da2222054f0a (diff)
changed the way ports are added to the server
Diffstat (limited to 'src/csharp/Grpc.Examples.MathServer')
-rw-r--r--src/csharp/Grpc.Examples.MathServer/MathServer.cs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/csharp/Grpc.Examples.MathServer/MathServer.cs b/src/csharp/Grpc.Examples.MathServer/MathServer.cs
index 4d6b43e5d3..5f7e717b0c 100644
--- a/src/csharp/Grpc.Examples.MathServer/MathServer.cs
+++ b/src/csharp/Grpc.Examples.MathServer/MathServer.cs
@@ -38,18 +38,19 @@ namespace math
{
class MainClass
{
+ const string Host = "0.0.0.0";
+ const int Port = 23456;
+
public static void Main(string[] args)
{
- string host = "0.0.0.0";
-
- Server server = new Server()
+ Server server = new Server
{
Services = { Math.BindService(new MathServiceImpl()) },
+ Ports = { { Host, Port, ServerCredentials.Insecure } }
};
- int port = server.AddPort(host, 23456, ServerCredentials.Insecure);
server.Start();
- Console.WriteLine("MathServer listening on port " + port);
+ Console.WriteLine("MathServer listening on port " + Port);
Console.WriteLine("Press any key to stop the server...");
Console.ReadKey();