Ejemplo n.º 1
0
        private void Init(WuYueConfig pWuYueConfig)
        {
            WeightDeviceLogger.Debug(string.Format("配置明细,发送IP地址:{0},端口:{1},接收端口:{2},零点最大偏差:{3}", pWuYueConfig.SendIp,
                                                   pWuYueConfig.SendPort, pWuYueConfig.ReceivePort, pWuYueConfig.DynamicOffset));

            _receiveDataQueue = new Queue <string>(20);
            _curWuYueConfig   = pWuYueConfig;

            _localIpep = new IPEndPoint(IPAddress.Parse(_curWuYueConfig.SendIp), _curWuYueConfig.SendPort);
            // 本机IP,指定的端口号
            _remoteIpep = new IPEndPoint(IPAddress.Any, _curWuYueConfig.ReceivePort);
            _udpcSend   = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            _udpcSend.Bind(_remoteIpep);
            WeightDeviceLogger.Debug("初始化五岳通讯服务成功!");
            ShowErrMsg("初始化五岳通讯服务成功!");
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     五岳衡器配置相关
 /// </summary>
 /// <param name="pWuYueConfig"></param>
 public WeightController(WuYueConfig pWuYueConfig)
 {
     WeightDeviceLogger.Debug("----------------------------------五岳通讯开始-----------------------------------");
     Init(pWuYueConfig);
 }