예제 #1
0
파일: FTPServer.cs 프로젝트: iam7roni/FTP
 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
파일: FTPServer.cs 프로젝트: iam7roni/FTP
        //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
파일: server.cs 프로젝트: Lockey-J/wodsoft
 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();
 }