Commit b92d8fb2 authored by 潘栩锋's avatar 潘栩锋 🚴

添加 Modbus.ServerTCP.cs 的线程版本

parent 80afe529
......@@ -61,7 +61,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WithThread\ClientTCP.cs" />
<Compile Include="WithThread\IModbusClient.cs" />
<Compile Include="WithThread\IModbusServer.cs" />
<Compile Include="WithThread\ModbusMapper_Client.cs" />
<Compile Include="WithThread\ServerTCP.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Project.FLY.FObjSys\FObjSys\FObjBase.csproj">
......
......@@ -21,7 +21,7 @@ namespace FLY.Modbus.WithThread
/// </summary>
public TimeSpan Timeout { get; set; } = TimeSpan.FromSeconds(2);
/// <summary>
/// socket 错误信息,带时间
/// socket 错误信息
/// </summary>
public string ErrMsg { get; set; }
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
namespace FLY.Modbus.WithThread
......@@ -16,6 +17,31 @@ namespace FLY.Modbus.WithThread
/// </summary>
TimeSpan Timeout { get; set; }
/// <summary>
/// socket 错误信息
/// </summary>
string ErrMsg { get; set; }
/// <summary>
/// 连接成功
/// </summary>
bool IsConnected { get; set; }
/// <summary>
/// 远端地址
/// </summary>
IPEndPoint RemoteEP { get; set; }
/// <summary>
/// 建立连接
/// </summary>
bool Connect();
/// <summary>
/// 停止
/// </summary>
void Close();
/// <summary>
/// 读多个 COIL
/// </summary>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
namespace FLY.Modbus.WithThread
{
public interface IModbusServer
{
/// <summary>
/// 通信超时, client 长时间连接上,但不通讯,会被断开
/// </summary>
TimeSpan Timeout { get; set; }
/// <summary>
/// 本地地址
/// </summary>
IPEndPoint LocalEP { get; set; }
/// <summary>
/// 当前连接数
/// </summary>
int ConnectedCnt { get; }
/// <summary>
/// 工作中
/// </summary>
bool IsRunning { get; set; }
/// <summary>
/// socket 错误信息
/// </summary>
string ErrMsg { get; set; }
GetValueHander GetValue { get; }
SetValueHander SetValue { get; }
void Start();
void Stop();
}
public delegate void GetValueHander(int addr, object values);
public delegate void SetValueHander(int addr, object values);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment