当前位置: 首页 > news >正文

aspx php哪个做门户网站好seo网站优化工具大全

aspx php哪个做门户网站好,seo网站优化工具大全,注册安全工程师报考官网,在住房城乡建设部网站上哪里下载规范Modbus TCP是一种基于以太网TCP/IP的Modbus协议变种,它允许Modbus协议在以太网网络上运行,使得设备之间可以通过IP网络交换数据。Modbus由MODICON公司于1979年开发,是一种工业现场总线协议标准,广泛应用于工业自动化领域。 #regio…

Modbus TCP是一种基于以太网TCP/IP的Modbus协议变种,它允许Modbus协议在以太网网络上运行,使得设备之间可以通过IP网络交换数据。Modbus由MODICON公司于1979年开发,是一种工业现场总线协议标准,广泛应用于工业自动化领域。

 #region  ModBusTCP 地址解释
 /* 00 01->事务标识符,随意指定
  00 00->协议标识符,Modbus TCP协议标识符为0x0000
  00 06->报文长度,表示后面的报文长度为6个字节
  01->广播地址
  03->功能码  0x01   读输出线圈
              0x02    读离散输入
              0x03    读保持寄存器
              0x04    读输入寄存器
              0x05    写单个线圈
              0x06    写单个保持寄存器
              0x0F    写多个线圈
              0x10    写多个保持寄存器
 00 64 读写地址高八位 低八位
 00 01 寄存器数量 
 */

using System;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Threading.Tasks;namespace ModbusTcpExample
{class Program{static void Main(string[] args){MBTCP mBTCP = new MBTCP();mBTCP.MDConnection("192.168.1.2", 502);}}class MBTCP{private bool ConnectionStatus = false;NetworkStream stream;//ModBusTCP启动public void MDConnection(string ipAddress, int port){try{TcpClient client = new TcpClient(ipAddress, port);stream = client.GetStream();ConnectionStatus = true;}catch (Exception e){Console.WriteLine("TCP connection failed: " + e.Message);ConnectionStatus = false;}}//读单个D寄存器public int ReadRegister(int address){if (ConnectionStatus){try{#region  ModBusTCP 地址解释/* 00 01->事务标识符,随意指定00 00->协议标识符,Modbus TCP协议标识符为0x000000 06->报文长度,表示后面的报文长度为6个字节01->广播地址03->功能码  0x01   读输出线圈0x02    读离散输入0x03    读保持寄存器0x04    读输入寄存器0x05    写单个线圈0x06    写单个保持寄存器0x0F    写多个线圈0x10    写多个保持寄存器00 64 读写地址高八位 低八位00 01 寄存器数量 */#endregionbyte H = (byte)((address >> 8) & 0xFF);byte L = (byte)(address & 0xFF);byte[] request = new byte[] { 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x01, 0x03, H, L, 0x00, 0x01 };stream.WriteAsync(request, 0, request.Length);  // 发送请求报文  byte[] response = new byte[12]; // 根据实际情况调整长度stream.ReadAsync(response, 0, response.Length);int decimalValue = (response[9] << 8) | response[10];return decimalValue;}catch (Exception e){Console.WriteLine("TCP connection failed: " + e.Message);ConnectionStatus = false;return 888;}}else{Console.WriteLine("TCP connection failed");return 888;}}//写单个D寄存器public bool WriteRegister(int address, int Wvalue){if (ConnectionStatus){try{byte H = (byte)((address >> 8) & 0xFF);byte L = (byte)(address & 0xFF);byte WH = (byte)((Wvalue >> 8) & 0xFF);byte WL = (byte)(Wvalue & 0xFF);byte[] request = new byte[] { 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x01, 0x06, H, L, WH, WL };stream.WriteAsync(request, 0, request.Length);  // 发送请求报文  byte[] response = new byte[12]; // 根据实际情况调整长度return false;}catch (Exception e){Console.WriteLine("TCP connection failed: " + e.Message);ConnectionStatus = false;return false;}}else{Console.WriteLine("TCP connection failed");return false;}}//读多个M寄存器public bool[] ReadMixeds(int address, int quantity){bool[] MB = new bool[quantity];if (ConnectionStatus){try{byte H = (byte)((address >> 8) & 0xFF);byte L = (byte)(address & 0xFF);byte QH = (byte)((quantity >> 8) & 0xFF);byte QL = (byte)(quantity & 0xFF);byte[] request = new byte[] { 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x01, 0x02, H, L, QH, QL };stream.WriteAsync(request, 0, request.Length);  // 发送请求报文  byte[] response = new byte[10 + quantity / 8]; // 根据实际情况调整长度stream.ReadAsync(response, 0, response.Length);Console.WriteLine("Received response:");foreach (var b in response){Console.Write(b.ToString("X2") + " ");}//bool[] MB = new bool[quantity];Console.WriteLine("\nMMMMReceived response:");int MT = 0;for (int n = 0; n < quantity / 8 + 1; n++){for (int i = 0; i < 8 && MT < quantity; i++){MB[MT] = ((response[9 + n] >> i) & 0x01) != 0;//int F = MT + address;//Console.WriteLine("M{0}.{1}", F, MB[MT]);MT++;}}return MB;}catch (Exception e){Console.WriteLine("TCP connection failed: " + e.Message);ConnectionStatus = false;return MB;}}else{Console.WriteLine("TCP connection failed");return MB;}}//写单个M寄存器public bool WriteMixed(int address, bool Wvalue){if (ConnectionStatus){try{byte H = (byte)((address >> 8) & 0xFF);byte L = (byte)(address & 0xFF);byte WByte = 0x00;if (Wvalue) { WByte = 0x01; }byte[] request = new byte[] { 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x01, 0x05, H, L, 0x00, WByte };stream.WriteAsync(request, 0, request.Length);  // 发送请求报文  byte[] response = new byte[12]; // 根据实际情况调整长度return true;}catch (Exception e){Console.WriteLine("TCP connection failed: " + e.Message);ConnectionStatus = false;return false;}}else{Console.WriteLine("TCP connection failed");return false;}}}}

http://www.15wanjia.com/news/37648.html

相关文章:

  • 北京网站优化托管天津百度网站排名优化
  • 美食网站建设规划书免费申请网站com域名
  • 重庆公司社保多少钱一个月sem优化软件选哪家
  • 有什么做木工的网站域名搜索引擎入口
  • 调查网站怎么做软文关键词排名推广
  • 做网站要法人身份证吗抖音搜索排名优化
  • 女人与马做受网站china东莞seo
  • 网络公司做网站服务器短信广告投放软件
  • 惠州b2b网站建设广点通和腾讯朋友圈广告区别
  • 青海餐饮网站建设网络营销方案设计范文
  • 网站代运营协议湖北seo网站推广
  • ecshop做的小说网站关键词录入榜
  • 深圳网站专业建设公司友情连接出售
  • 帮人做非法网站吗百度服务电话在线人工
  • 做餐厅网站的需求分析搜索引擎优化
  • 有趣的网站网址营销策略分析论文
  • 怎么可以建网站长尾关键词网站
  • 望野小说公司的seo是什么意思
  • 长春做网站新格公司如何在百度上投放广告
  • 国外做西餐的网站网站优化培训
  • wordpress 图片缩放插件西安关键词优化软件
  • 建设局哪个网站查证凡科建站app
  • 二手网站建设模块seo教程seo优化
  • 网站备案号微信营销软件哪个好用
  • 长裕建设有限公司网站查询网站域名
  • 企业网站优化暴肃湖南岚鸿很好长尾关键词查询
  • 长沙做网站改版价格免费的网页制作软件
  • 建设工程业绩查询网站新开传奇网站发布站
  • 芜湖又出现一例网站推广优化排名教程
  • 新泰做网站网络竞价推广托管公司