资源简介
C# ModBus Tcp读写数据 与服务器进行通讯,内包含客户端和服务端源码。
代码片段和文件信息
import HslCommunication.Core.Net.NetHandle;
import HslCommunication.Core.Transfer.DataFormat;
import HslCommunication.Core.Types.ActionOperateExThree;
import HslCommunication.Core.Types.ActionOperateExTwo;
import HslCommunication.Core.Types.OperateResult;
import HslCommunication.Core.Types.OperateResultExOne;
import HslCommunication.Enthernet.ComplexNet.NetComplexClient;
import HslCommunication.Enthernet.PushNet.NetPushClient;
import HslCommunication.Enthernet.SimplifyNet.NetSimplifyClient;
import HslCommunication.ModBus.ModbusTcpNet;
import HslCommunication.Profinet.Melsec.MelsecMcAsciiNet;
import HslCommunication.Profinet.Melsec.MelsecMcNet;
import HslCommunication.Profinet.Siemens.SiemensPLCS;
import HslCommunication.Profinet.Siemens.SiemensS7Net;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
//NetSimplifyClientTest();
//MelsecTest();
//PushNetTest();
//ModbusTcpTets();
//SiemesTest();
try {
//Constructor[] aa = Integer.class.getDeclaredConstructors();
//int i = (Integer) (aa[1].newInstance(“1“));
//System.out.println(Utilities.bytes2HexString( Utilities.getBytes(String.format(“%04x“100)“ASCII“)));
//System.out.println(i);
//System.out.println(Arrays.toString(“123“.split(“\\.“ )));
ModbusTcpTets();
}
catch (Exception ex){
System.out.println(ex.getMessage());
}
try {
Thread.sleep(1000);
} catch (Exception ex) {
}
}
public static void NetSimplifyClientTest() {
NetSimplifyClient client = new NetSimplifyClient(“127.0.0.1“ 12345);
OperateResultExOne read = client.ReadFromServer(new NetHandle(2) “测试数据“);
if (read.IsSuccess) {
System.out.println(read.Content);
} else {
System.out.println(“读取失败:“ + read.Message);
}
}
private static void MelsecTest() {
MelsecMcNet melsec_net = new MelsecMcNet(“192.168.1.192“ 6001);
boolean[] M100 = melsec_net.ReadBool(“M100“ (short) 1).Content; // 读取M100是否通,十进制地址
boolean[] X1A0 = melsec_net.ReadBool(“X1A0“ (short) 1).Content; // 读取X1A0是否通,十六进制地址
boolean[] Y1A0 = melsec_net.ReadBool(“Y1A0“ (short) 1).Content; // 读取Y1A0是否通,十六进制地址
boolean[] B1A0 = melsec_net.ReadBool(“B1A0“ (short) 1).Content; // 读取B1A0是否通,十六进制地址
short short_D1000 = melsec_net.ReadInt16(“D1000“).Content; // 读取D1000的short值 W3C0R3C0 效果是一样的
int int_D1000 = melsec_net.ReadInt32(“D1000“).Content; // 读取D1000-D1001组成的int数据
float float_D1000 = melsec_net.ReadFloat(“D1000“).Content; // 读取D1000-D1001组成的float数据
long long_D1000 = melsec_net.ReadInt64(“D1000“).Content; // 读取D1000-D1003组成的long数据
double double_D1000 = melsec_net.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 2518 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\.gitattributes
....... 4305 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\.gitignore
文件 692052 2018-09-14 16:35 HslCommunication-master\HslCommunication-master\.vs\HslCommunication\DesignTimeBuild\.dtbcache
..A..H. 278016 2018-09-14 16:35 HslCommunication-master\HslCommunication-master\.vs\HslCommunication\v15\.suo
文件 0 2018-09-14 10:02 HslCommunication-master\HslCommunication-master\.vs\HslCommunication\v15\Server\sqlite3\db.lock
文件 3256320 2018-09-14 10:02 HslCommunication-master\HslCommunication-master\.vs\HslCommunication\v15\Server\sqlite3\storage.ide
文件 32768 2018-09-14 10:02 HslCommunication-master\HslCommunication-master\.vs\HslCommunication\v15\Server\sqlite3\storage.ide-shm
文件 4404312 2018-09-14 15:46 HslCommunication-master\HslCommunication-master\.vs\HslCommunication\v15\Server\sqlite3\storage.ide-wal
....... 3746 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\chmHelper.shfbproj
....... 7067 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\docs\English.md
....... 6609 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\docs\Melsec.md
....... 5277 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\docs\ModbusServer.md
....... 5863 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\docs\ModbusTcp.md
....... 5790 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\docs\Omron.md
....... 7026 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\docs\Siemens.md
....... 132443 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\Download\HslCommunication.jar
....... 929622 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\Download\HslCommunication.zip
....... 1091097 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\Download\HslCommunicationDemo.zip
....... 2851231 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\Download\HSLSharp.zip
....... 807950 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\Download\ModbusTcpServer.zip
....... 760592 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\Download\PushNetServer.zip
....... 4178184 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\Help\HslCommunication.chm
....... 9354 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\HslCommunication.sln
....... 425 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\HslCommunication_Java\HslCommunication\HslCommunication.iml
....... 6633 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\HslCommunication_Java\HslCommunication\out\production\HslCommunication\HslCommunication\Basicfr
....... 956 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\HslCommunication_Java\HslCommunication\out\production\HslCommunication\HslCommunication\Basicfr
....... 325 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\HslCommunication_Java\HslCommunication\out\production\HslCommunication\HslCommunication\Basicfr
....... 1645 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\HslCommunication_Java\HslCommunication\out\production\HslCommunication\HslCommunication\Basicfr
....... 2854 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\HslCommunication_Java\HslCommunication\out\production\HslCommunication\HslCommunication\Basicfr
....... 937 2018-09-13 22:41 HslCommunication-master\HslCommunication-master\HslCommunication_Java\HslCommunication\out\production\HslCommunication\HslCommunication\Core\Address\DeviceAddressba
............此处省略1496个文件信息
相关资源
- 免费DataGridView打印及.NET轻松打印控件
- C# SECS 通信源代码
- Professional.C#7.and.NET.Core.2.0.2018.4.epub
- Visual C#2008版 应用案例教程[郑阿奇]
- C#自定义控件之-winform美化
- C# KTV项目 练手
- CRM客户关系管理系统源码,C#.NET
- 吉日嘎拉 C#.NET 通用权限管理系统组件
-
基于Arcob
jects与C#.net的gis应用开发 - C# WinForm实践开发教程 窗体程序开发教
- 深入浅出WPF(中文版)
- C#实现简单的音乐播放器只支持.wav格
- C#实现图片鼠标拖动和滚动缩放《新纹
- EmguCV3.4.3
- 基于C# MVC开发的WEB API通用框架 附带
- C#数字图像处理算法典型](随书光盘
- c#图解教程(第4版)中文完整版和源
- c# 人脸识别源码和使用说明
- 深入体验ASP.NET项目开发_源码
- C#课程设计案例精编第2版
- 基于C# MVC开发的WEB API通用框架 附带
- rabbitMQ封装c#
- AE的MapControl直接加载Oracle数据(C#)
- Unity3d开发案例(坦克克星游戏,C#版
- 超级实用的Shape转WKT利器,有源码
- Professional C# 7 and .NET Core 2.0
- C#窗体开发程序 学校管理系统 WINFOR
- C#开发B/S后台管理系统
- C#多线程编程实战_中文完整版带书签
- win8应用商店程序fashionHouse
评论
共有 条评论