Beispiel #1
0
        internal FTPClient(Socket ClientSocket)
        {
            this.ClientSocket = ClientSocket;
            //SubItems[1].Text = ClientSocket.RemoteEndPoint.ToString();
            ClientSocket.NoDelay = false;
            ConnectedTime = DateTime.Now;

            ConnectedUser = new FTPUser();
            //SubItems[3].Text = SubItems[4].Text = (CurrentUser.ConnectedTime = DateTime.Now).ToString("MMM dd, yyyy hh:mm:ss");

            // Report the client that the server is ready to serve.
            SendMessage("220 FTP Ready\r\n");

            // Wait for the command to be sent by the client
            ClientSocket.BeginReceive(BufferData, 0, BufferData.Length, SocketFlags.None, new AsyncCallback(CommandReceived), null);
            //ClientStream.BeginRead(BufferData, 0, BufferData.Length, new AsyncCallback(CommandReceived), null);
        }
Beispiel #2
0
        internal void Disconnect()
        {
            if (ClientSocket != null && ClientSocket.Connected) ClientSocket.Close(); ClientSocket = null;
            if (DataListener != null) DataListener.Stop(); DataListener = null;
            ClientEndPoint = null;
            ConnectedUser = null;

            BufferData = null;
            Rename_FilePath = null;
            ApplicationSettings.FtpServer.FTPClients.Remove(this);
            GC.Collect();
        }