using Renci.SshNet; using Npgsql; namespace DeviceAdmin { internal static class Program { public static NpgsqlConnection connection { get; set; } public static SshClient client; public static ForwardedPortLocal portForwarded; [STAThread] static void Main() { ApplicationConfiguration.Initialize(); PasswordConnectionInfo connectionInfo = new PasswordConnectionInfo("127.0.0.1", 5432, "ubuntu", "ubuntu"); client = new SshClient(connectionInfo); client.Connect(); portForwarded = new ForwardedPortLocal("127.0.0.1", 15432, "127.0.0.1", 5432); client.AddForwardedPort(portForwarded); portForwarded.Start(); connection = new NpgsqlConnection("Server=127.0.0.1;Port=15432;Database=device;User Id=postgres;Password=postgres;"); connection.Open(); Application.Run(new FormMain()); } } }