驱动支持主机名称

This commit is contained in:
2248356998 qq.com
2023-03-29 11:07:21 +08:00
parent df6c9d55b5
commit bbad36d576
11 changed files with 11 additions and 12 deletions

View File

@@ -48,7 +48,7 @@ namespace ThingsGateway.Modbus
{
if (client == null)
{
TouchSocketConfig.SetRemoteIPHost(new IPHost(IPAddress.Parse(IP), Port))
TouchSocketConfig.SetRemoteIPHost(new IPHost($"{ IP}:{Port }"))
.SetBufferLength(1024);
client = TouchSocketConfig.Container.Resolve<TGTcpClient>();
((TGTcpClient)client).Setup(TouchSocketConfig);

View File

@@ -46,7 +46,7 @@ namespace ThingsGateway.Modbus
{
if (client == null)
{
TouchSocketConfig.SetRemoteIPHost(new IPHost(IPAddress.Parse(IP), Port))
TouchSocketConfig.SetRemoteIPHost(new IPHost($"{IP}:{Port}"))
.SetBufferLength(1024);
client = TouchSocketConfig.BuildWithUdpSession<UdpSession>();
}

View File

@@ -3,7 +3,6 @@
using SqlSugar;
using System.Collections.Concurrent;
using System.Net;
using ThingsGateway.Foundation;
using ThingsGateway.Foundation.Adapter.Modbus;
@@ -67,7 +66,7 @@ namespace ThingsGateway.Modbus
curDevice = device;
TouchSocketConfig.ConfigureContainer(a => a.RegisterSingleton<ILog>(new EasyLogger(Log_Out)));
TouchSocketConfig.SetListenIPHosts(new IPHost[] { new IPHost(IPAddress.Parse(IP), Port) })
TouchSocketConfig.SetListenIPHosts(new IPHost[] { new IPHost($"{IP}:{Port}") })
.SetBufferLength(1024);
var service = TouchSocketConfig.Container.Resolve<TcpService>();
service.Setup(TouchSocketConfig);

View File

@@ -50,7 +50,7 @@ namespace ThingsGateway.Modbus
{
if (client == null)
{
TouchSocketConfig.SetRemoteIPHost(new IPHost(IPAddress.Parse(IP), Port))
TouchSocketConfig.SetRemoteIPHost(new IPHost($"{IP}:{Port}"))
.SetBufferLength(1024);
client = TouchSocketConfig.Container.Resolve<TGTcpClient>();
((TGTcpClient)client).Setup(TouchSocketConfig);

View File

@@ -48,7 +48,7 @@ namespace ThingsGateway.Modbus
{
if (client == null)
{
TouchSocketConfig.SetRemoteIPHost(new IPHost(IPAddress.Parse(IP), Port))
TouchSocketConfig.SetRemoteIPHost(new IPHost($"{IP}:{Port}"))
.SetBufferLength(1024);
client = TouchSocketConfig.BuildWithUdpSession<UdpSession>();
}

View File

@@ -10,7 +10,7 @@
{
if (client == null)
{
TouchSocketConfig.SetRemoteIPHost(new IPHost(IPAddress.Parse(IP), Port))
TouchSocketConfig.SetRemoteIPHost(new IPHost($"{IP}:{Port}"))
.SetBufferLength(1024);
client = TouchSocketConfig.Container.Resolve<TGTcpClient>();
((TGTcpClient)client).Setup(TouchSocketConfig);

View File

@@ -10,7 +10,7 @@
{
if (client == null)
{
TouchSocketConfig.SetRemoteIPHost(new IPHost(IPAddress.Parse(IP), Port))
TouchSocketConfig.SetRemoteIPHost(new IPHost($"{IP}:{Port}"))
.SetBufferLength(1024);
client = TouchSocketConfig.Container.Resolve<TGTcpClient>();
((TGTcpClient)client).Setup(TouchSocketConfig);

View File

@@ -10,7 +10,7 @@
{
if (client == null)
{
TouchSocketConfig.SetRemoteIPHost(new IPHost(IPAddress.Parse(IP), Port))
TouchSocketConfig.SetRemoteIPHost(new IPHost($"{IP}:{Port}"))
.SetBufferLength(1024);
client = TouchSocketConfig.Container.Resolve<TGTcpClient>();
((TGTcpClient)client).Setup(TouchSocketConfig);

View File

@@ -10,7 +10,7 @@
{
if (client == null)
{
TouchSocketConfig.SetRemoteIPHost(new IPHost(IPAddress.Parse(IP), Port))
TouchSocketConfig.SetRemoteIPHost(new IPHost($"{IP}:{Port}"))
.SetBufferLength(1024);
client = TouchSocketConfig.Container.Resolve<TGTcpClient>();
((TGTcpClient)client).Setup(TouchSocketConfig);

View File

@@ -10,7 +10,7 @@
{
if (client == null)
{
TouchSocketConfig.SetRemoteIPHost(new IPHost(IPAddress.Parse(IP), Port))
TouchSocketConfig.SetRemoteIPHost(new IPHost($"{IP}:{Port}"))
.SetBufferLength(1024);
client = TouchSocketConfig.Container.Resolve<TGTcpClient>();
((TGTcpClient)client).Setup(TouchSocketConfig);

View File

@@ -10,7 +10,7 @@
{
if (client == null)
{
TouchSocketConfig.SetRemoteIPHost(new IPHost(IPAddress.Parse(IP), Port))
TouchSocketConfig.SetRemoteIPHost(new IPHost($"{IP}:{Port}"))
.SetBufferLength(1024);
client = TouchSocketConfig.Container.Resolve<TGTcpClient>();
((TGTcpClient)client).Setup(TouchSocketConfig);