CZ_Power/UdpSync.cs

(开头部分) 27KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
using System.Threading;
using ComLibiary;
using SanNiuSignal;
using System.Collections;

namespace CZ_Power
{
    class UdpSync : CommandEnmuQueue
    {  
        #region 同步系统的字段
        private byte[] FrameHeader = new byte[] { 0xE0, 0xE0 };//帧头
        private byte[] FrameFooter = new byte[] { 0xF0, 0xF0 };//帧尾 
        private List<byte> SendBuffer = new List<byte>();//发送队列 
        private byte udpStatus = 0x01;     //0x00:正常 0x01:异常  需要初始化为异常
        private bool isActiveUdp = false;  //true:激活通讯
        private Thread thd = null;
        private bool run = false;//线程开关
        private object o = new object();
        private int HeartCount = 0;
        #endregion

        #region 字段
        private IPEndPoint udpRemoteIPPoint = null;
        public IPEndPoint UdpRemoteIPPoint
        {
            get { return udpRemoteIPPoint; }
            set { udpRemoteIPPoint = value; }
        }
        private string Ip;
        private int Port;
        public UdpSync(string ip_in, int port_in)
        {
            Ip = ip_in;
            Port = port_in;
        }

        private int limitStatus = 0;//网络异常计数
        public byte UdpStatus
        {
            get { return udpStatus; }
            set
            {
                if (limitStatus > 3)//计数器超限,如果网络异常则赋值
                {
                    if (value == 0x01)
                    {
                        udpStatus = value;
                    }
                    limitStatus = 0;
                }
                else//计数器没超限,如果网络正常则赋值
                {
                    if (value == 0x00)
                    {
                        udpStatus = value;
                    }
后面还有 607 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。