Files
dotnet-screenlogic/RemoteConnect.cs
Parnic d6dfcb14a9 Added support for remote connection by name via Pentair servers
This brings along proper password encryption and validation for the login process (which is still not needed for local connections).

You can run the remote connection tests by passing a system name and password as 2 arguments (so the system name needs to be quoted, e.g.: `test "Pentair: xx-xx-xx" 1234`)

Also updated to latest .NET Core and C# versions while I was at it.
2019-02-20 15:19:42 -06:00

23 lines
757 B
C#

using System.Net.Sockets;
using System.Threading.Tasks;
namespace ScreenLogicConnect
{
public class RemoteConnect
{
public const int ServerDispatcherPort = 500;
public const string ServerDispatcherURL = "screenlogicserver.pentair.com";
public static async Task<EasyTouchUnit> GetGatewayInfo(string systemName)
{
using (var client = new TcpClient())
{
client.Connect(ServerDispatcherURL, ServerDispatcherPort);
var ns = client.GetStream();
ns.SendHLMessage(Messages.GetGatewayData.QUERY(systemName));
return new EasyTouchUnit(new Messages.GetGatewayData(await UnitConnection.GetMessage(ns)));
}
}
}
}