summaryrefslogtreecommitdiffstats
path: root/samples/OnlinePhoneBook/SimlifiedPhoneBookClient/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'samples/OnlinePhoneBook/SimlifiedPhoneBookClient/Program.cs')
-rw-r--r--samples/OnlinePhoneBook/SimlifiedPhoneBookClient/Program.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/samples/OnlinePhoneBook/SimlifiedPhoneBookClient/Program.cs b/samples/OnlinePhoneBook/SimlifiedPhoneBookClient/Program.cs
new file mode 100644
index 0000000..370e58b
--- /dev/null
+++ b/samples/OnlinePhoneBook/SimlifiedPhoneBookClient/Program.cs
@@ -0,0 +1,27 @@
+using System;
+using Hik.Communication.Scs.Communication.EndPoints.Tcp;
+using Hik.Communication.ScsServices.Client;
+using PhoneBookCommonLib;
+
+/* This is the simplest client application that uses phone book server.
+ * (Just 2 lines of code to connect to the server and call a method.
+ */
+
+namespace SimlifiedPhoneBookClient
+{
+ class Program
+ {
+ static void Main()
+ {
+ Console.ReadLine();
+
+ //Create a client to connecto to phone book service on local server and 10048 TCP port.
+ var client = ScsServiceClientBuilder.CreateClient<IPhoneBookService>(new ScsTcpEndPoint("127.0.0.1", 10048));
+
+ //Directly call a method (it automatically connects, calls and disconnects)
+ client.ServiceProxy.AddPerson(new PhoneBookRecord { Name = "Halil ibrahim", Phone = "5881112233" });
+
+ Console.ReadLine();
+ }
+ }
+}