diff --git a/EasyModbusTCPCore/ModbusClient.cs b/EasyModbusTCPCore/ModbusClient.cs index 0a13e5a..856bc34 100644 --- a/EasyModbusTCPCore/ModbusClient.cs +++ b/EasyModbusTCPCore/ModbusClient.cs @@ -10,6 +10,7 @@ using System.Reflection; using System.Text; using System.Collections.Generic; +using System.Threading.Tasks; namespace EasyModbus { @@ -73,13 +74,13 @@ public ModbusClient() /// /// Establish connection to Master device in case of Modbus TCP. Opens COM-Port in case of Modbus RTU /// - public void Connect() + public async Task ConnectAsync() { if (debug) StoreLogData.Instance.Store("Open TCP-Socket, IP-Address: " + ipAddress + ", Port: " + port, System.DateTime.Now); tcpClient = new TcpClient(); - var result = tcpClient.ConnectAsync(ipAddress, port); + await tcpClient.ConnectAsync(ipAddress, port); //tcpClient = new TcpClient(ipAddress, port); @@ -91,13 +92,13 @@ public void Connect() /// /// Establish connection to Master device in case of Modbus TCP. /// - public void Connect(string ipAddress, int port) + public async Task ConnectAsync(string ipAddress, int port) { if (debug) StoreLogData.Instance.Store("Open TCP-Socket, IP-Address: " + ipAddress + ", Port: " + port, System.DateTime.Now); tcpClient = new TcpClient(); - var result = tcpClient.ConnectAsync(ipAddress, port); + await tcpClient.ConnectAsync(ipAddress, port); //tcpClient = new TcpClient(ipAddress, port);