示例#1
0
 private static void CreateAISMessage()
 {
     while (true)
     {
         Thread.Sleep(500);
         //Console.WriteLine("..");
         //메세지 생성.
         DataPayload dp = new DataPayload();
         SendMessage = $"!AIVDM,1,1,,B,{dp.CreateDataPayLoadBinary()},0";
         SendMessage = SendMessage + "*" + MakeChecksum(SendMessage);
     }
 }
示例#2
0
        private static async Task Send(TcpClient tc, NetworkStream stream)
        {
            Thread.Sleep(500);
            TcpState tcpState = tc.GetClientState();

            if (!tc.Connected)
            {
                return;
            }
            if (tcpState == TcpState.Established)
            {
                DataPayload dp      = new DataPayload();
                byte[]      byteMsg = Encoding.Default.GetBytes(SendMessage + Environment.NewLine);
                await stream.WriteAsync(byteMsg, 0, byteMsg.Length).ConfigureAwait(false);
            }
        }