Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.Title = "SAEA.Sockets.TcpTest JT808";

            //jserver
            JServer jServer = new JServer();

            jServer.OnReceive += JServer_OnReceive;
            jServer.Start();

            //jclient
            JClient jClient = new JClient();

            jClient.OnReceive += JClient_OnReceive;
            jClient.Connect();
            jClient.SendAsync(GetJT808PositionData());

            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.Title = "SAEA.Sockets.TcpTest JT808";

            //jserver
            JServer jServer = new JServer();

            jServer.OnReceive += JServer_OnReceive;
            jServer.Start();

            //jclient
            JClient jClient1 = new JClient();

            jClient1.OnReceive += JClient_OnReceive;
            jClient1.Connect();
            for (int i = 0; i < 10; i++)
            {
                jClient1.SendAsync(GetJT808PositionData());
                Thread.Sleep(500);
            }
            jClient1.Disconnect();

            //jclient
            JClient2 jClient2 = new JClient2();

            jClient2.Connect();
            for (int i = 0; i < 10; i++)
            {
                jClient2.Send(GetJT808PositionData());
                Thread.Sleep(1000);
                var data = jClient2.Receive();
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine($"client 收到平台通用应答,MsgNum:{data.Header.MsgNum}");
            }

            jClient2.Disconnect();

            Console.ReadLine();
        }
Exemplo n.º 3
0
 private static void JClient_OnReceive(JClient arg1, JT808Package arg2)
 {
     Console.ForegroundColor = ConsoleColor.Green;
     Console.WriteLine($"client 收到平台通用应答,MsgNum:{arg2.Header.MsgNum}");
 }