资源简介
找ModbusTCP好久,一点也不全,现传一个client端包含报头和协议部分,免费随便下。
代码片段和文件信息
using System;
using System.Collections;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace ModbusTCP
{
///
/// Modbus TCP common driver class. This class implements a modbus TCP master driver.
/// It supports the following commands:
///
/// Read coils
/// Read discrete inputs
/// Write single coil
/// Write multiple cooils
/// Read holding register
/// Read input register
/// Write single register
/// Write multiple register
///
/// All commands can be sent in synchronous or asynchronous mode. If a value is accessed
/// in synchronous mode the program will stop and wait for slave to response. If the
/// slave didn‘t answer within a specified time a timeout exception is called.
/// The class uses multi threading for both synchronous and asynchronous access. For
/// the communication two lines are created. This is necessary because the synchronous
/// thread has to wait for a previous command to finish.
///
///
public class Master
{
// ------------------------------------------------------------------------
// Constants for access
private const byte fctReadCoil = 1;
private const byte fctReadDiscreteInputs = 2;
private const byte fctReadHoldingRegister = 3;
private const byte fctReadInputRegister = 4;
private const byte fctWriteSingleCoil = 5;
private const byte fctWriteSingleRegister = 6;
private const byte fctWriteMultipleCoils = 15;
private const byte fctWriteMultipleRegister = 16;
private const byte fctReadWriteMultipleRegister = 23;
/// Constant for exception illegal function.
public const byte excIllegalFunction = 1;
/// Constant for exception illegal data address.
public const byte excIllegalDataAdr = 2;
/// Constant for exception illegal data value.
public const byte excIllegalDataVal = 3;
/// Constant for exception slave device failure.
public const byte excSlaveDeviceFailure = 4;
/// Constant for exception acknowledge.
public const byte excAck = 5;
/// Constant for exception slave is busy/booting up.
public const byte excSlaveIsBusy = 6;
/// Constant for exception gate path unavailable.
public const byte excGatePathUnavailable = 10;
/// Constant for exception not connected.
public const byte excExceptionNotConnected = 253;
/// Constant for exception connection lost.
public const byte excExceptionConnectionLost = 254;
/// Constant for exception response timeout.
public
相关资源
- MB_Client_Four_Connections.rar
- MB_Client_Two_Connections.rar
- instantclient_11_264位与32位压缩包地址百
- sc_client_control_interface_tcp_vcpp
- httpclient请求httpsdemo
- ModbusTCP_Slave程序
- 基于delphi TCPclient与TCPserver的聊天程序
- WSUS client诊断工具
-
[原创]Hba
seClient - ModbusTCP测试程序源码
- HttpClient工具类
- Matrikon OPC Client
- 基于STM32F103的W5500 TCP Client测试程序
- HttpClient工具详细
- httpClient 调用远程接口 获取数据到本
- HttpClient4.3教程.PDF
- windows网络编程serverandclient猜拳游戏
- tcpClientAndServerTools v1.0.0.rar
- 北信源卸载工具ClientUninstall.zip
- Netzob官网的server以及client
- NC6.5 Uclient多开解决方法
- SOCKET TCP 文件传输 客户端 服务器端
- OPC Client.exe
- sslclient-win-1.1.3.173.pkg
- UDPServerClientTest.zip
- OPCClient.exe
- vpnclient.exe
- zw_BTClient.zip
- IBM-CLIENT PCOM
- 思科客户端--ciscoclient
评论
共有 条评论