blob: 2d835591338bb58ec7d49843a5ad798464c9009f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
using System;
using CommonLib;
using Hik.Communication.Scs.Client;
using Hik.Communication.Scs.Communication.EndPoints.Tcp;
using Hik.Communication.Scs.Communication.Messages;
namespace ClientApp
{
class OneWayClientCustomProtocol
{
public static void Run()
{
Console.WriteLine("Press enter to connect to server and send " + Consts.MessageCount + " messages.");
Console.ReadLine();
using (var client = ScsClientFactory.CreateClient(new ScsTcpEndPoint("127.0.0.1", 10033)))
{
client.WireProtocol = new MyWireProtocol();
client.Connect();
for (var i = 0; i < Consts.MessageCount; i++)
{
client.SendMessage(new ScsTextMessage("Hello from client!"));
}
Console.WriteLine("Press enter to disconnect from server");
Console.ReadLine();
}
}
}
}
|