/// <summary> /// Kick first connection /// </summary> private static void KickFirstConnection() { Console.WriteLine("\n-- {0} --", MethodBase.GetCurrentMethod().Name); using (IFileZillaApi fileZillaApi = new FileZillaApi(IPAddress.Parse(Ip), Port) { Log = DebugLog }) { fileZillaApi.Connect(ServerPassword); var connections = fileZillaApi.GetConnections(); if (connections.Any()) { if (fileZillaApi.Kick(connections.First().ConnectionId)) { Console.WriteLine("Connection was kicked"); } else { Console.WriteLine("Connection was NOT kicked"); } } else { Console.WriteLine("No connections available"); } } }
private static void GetConnections() { Console.WriteLine("\n-- {0} --", MethodBase.GetCurrentMethod().Name); using (IFileZillaApi fileZillaApi = new FileZillaApi(IPAddress.Parse(Ip), Port) { Log = DebugLog }) { var stopWatch = Stopwatch2.StartNew(); fileZillaApi.Connect(ServerPassword); var serverState = fileZillaApi.GetServerState(); Console.WriteLine("Connected in {0}. State is {1}", stopWatch.GetDelta(), serverState); var conections = fileZillaApi.GetConnections(); Console.WriteLine("Got {0} connections in {1}", conections.Count, stopWatch.GetDelta()); } }
/// <summary> /// Kick first connection /// </summary> private static void KickFirstConnection() { Console.WriteLine("-- {0} --", MethodBase.GetCurrentMethod().Name); using (IFileZillaApi fileZillaApi = new FileZillaApi(IPAddress.Parse(Ip), Port) { Log = new DebugTextWriter() }) { fileZillaApi.Connect(ServerPassword); var connections = fileZillaApi.GetConnections(); if (connections.Any()) { if (fileZillaApi.Kick(connections.First().ConnectionId)) Console.WriteLine("Connection was kicked"); else Console.WriteLine("Connection was NOT kicked"); } else Console.WriteLine("No connections available"); } }
private static void GetConnections() { Console.WriteLine("-- {0} --", MethodBase.GetCurrentMethod().Name); using (IFileZillaApi fileZillaApi = new FileZillaApi(IPAddress.Parse(Ip), Port) { Log = new DebugTextWriter() }) { var stopWatch = Stopwatch2.StartNew(); fileZillaApi.Connect(ServerPassword); var serverState = fileZillaApi.GetServerState(); Console.WriteLine("Connected in {0}. State is {1}", stopWatch.GetDelta(), serverState); var conections = fileZillaApi.GetConnections(); Console.WriteLine("Got {0} connections in {1}", conections.Count, stopWatch.GetDelta()); } }