首先Modbus slave配置如下:
代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using Modbus.Device;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
IPAddress address = new IPAddress(new byte[] { 127, 0, 0, 1 });
using (TcpClient clinet = new TcpClient(ad