Пример #1
0
 public void Dispose()
 {
     if (FTPCommandListner != null)
     {
         bClose = true;
         Thread.CurrentThread.Join(1000);
         if (FTPCommandListner.Pending())
         {
             FTPCommandListner.Stop();
         }
         //FTPCommandListner.Stop();
     }
 }
Пример #2
0
 public void Stop()
 {
     if (listener != null)
     {
         listener.Stop();
     }
 }
Пример #3
0
 public void Stop()
 {
     if (stopped)
     {
         return;
     }
     stopped = true;
     _tcpListener?.Stop();
     _udpListener?.Stop();
     StopPlugins();
     if (privoxyRunner != null)
     {
         privoxyRunner.Stop();
     }
     if (_config.enabled)
     {
         SystemProxy.Update(_config, true, null);
     }
 }
Пример #4
0
        public static void CloseServer()
        {
            try
            {
                TCPListener.Stop();
                UDPClient.Close();
                Console.WriteLine($"\tClosed Server: {ServerName}");
            }
            catch (Exception exception)
            {
                Console.WriteLine($"\tError closing Server: {ServerName}...\n{exception}");
            }

            if (MainServerComms.EstablishedConnection)
            {
                Environment.Exit(1);
            }
        }
Пример #5
0
 public bool Stop()
 {
     if (IsShuttingDown)
     {
         return(false);
     }
     try
     {
         UDPReciever.Close();
         TCPListener.Stop();
         IsShuttingDown = true;
     }
     catch
     {
         //???
     }
     return(IsShuttingDown);
 }
Пример #6
0
 /// <summary>
 /// Dispose
 /// </summary>
 public void Dispose()
 {
     if (TCPListener != null)
     {
         TCPListener.Stop();
         TCPListener = null;
     }
     if (listenerThread != null)
     {
         listenerThread.Join();
         listenerThread = null;
     }
     lock (serverConnections)
     {
         foreach (ServerConnection server_connection in serverConnections)
         {
             server_connection.Dispose();
         }
         serverConnections.Clear();
     }
 }
Пример #7
0
        //Passive Data MODE
        private int PassiveModePort(ref TCPListener clientDataListner)
        {
            Thread oThread = Thread.CurrentThread;

            lock (oThread)
            {
                int  intPort = 0;
                bool done    = true;
                while (done)
                {
                    intPort = Port();
                    try
                    {
                        if (clientDataListner != null)
                        {
                            clientDataListner.Stop();
                        }
                        clientDataListner = new TCPListener(intPort);
                        clientDataListner.Start();
                        //This Port is free
                        done = false;
                    }
                    catch (Exception e)
                    {
                        //done=false;
                    }
                }
                return(intPort);

                /*
                 * strIPAddress = CStr(wscControl.LocalIP)
                 * strSend = "PORT " & Replace(strIPAddress, ".", ",")
                 * strSend = strSend & "," & intPort \ 256 & "," & (intPort Mod 256)
                 * strSend = strSend & vbCrLf
                 * wscControl.SendData strSend
                 */
            }
        }
Пример #8
0
 public void Stop()
 {
     Listener.Stop();
 }
Пример #9
0
 private void Button1_Click(object sender, EventArgs e)
 {
     listener.Stop();
 }
Пример #10
0
 public void Stop()
 {
     _tcpListener?.Stop();
     _udpListener?.Stop();
 }
Пример #11
0
 public void Stop()
 {
     mutex.Set();
     thread.Join();
     listener.Stop();
 }
Пример #12
0
 private static void OnEndingConsoleApplication(object sender, EventArgs e)
 {
     TCPListener.Stop();
     UDPClient.Close();
 }