Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8422489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:27:43+00:00 2026-06-10T03:27:43+00:00

i have a ftp server that uses a serve_forever command. this ftp service is

  • 0

i have a ftp server that uses a serve_forever command. this ftp service is called in a thread ,what i want to do is that i want to abruptly close the thread from the main thread ,when i hit the stop button on my GUI.

import os
import sqlite3
from pyftpdlib import ftpserver
def main():
    authorizer = ftpserver.DummyAuthorizer()
    #does something
    address = ('127.0.0.1', 10221)
    ftpd = ftpserver.FTPServer(address, handler)

    # start ftp server
    ftpd.serve_forever()
if __name__ == '__main__':
    main()

this is my main thread which calls the ftp service

def start_ftp(self):
    self.ftp_status.setText("Running")
    self.ftp_status.setStyleSheet("Background : light green")
    #thread.start_new_thread( FtpService )

def stop_ftp(self):
    self.ftp_status.setText("Stopped")
    self.ftp_status.setStyleSheet("Background : red")
    #what should i put here for the desired result

please help guys

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:27:45+00:00Added an answer on June 10, 2026 at 3:27 am

    According to the documentation, close_all should “Stop serving …”, so serve_forever should return.

    Store your ftpd object in a global variable (currently it is local to main), you can call close or close_all from the main thread.


    Per your comment, the steps are:

    1. make ftpd = ftpserver.FTPServer(address, handler) refer to a global variable
    2. call ftpd.close_all() when you want to stop serving ftp connections
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some c# code that downloads files from an FTP server. It works
hello I have my code that connects to my ftp server $conn_id = ftp_connect($ftp_server);
We have several cron jobs that ftp proxy logs to a centralized server. These
I have this method to transfer files using a FTP Server: private void TransferNeededFiles(IEnumerable<string>
i have a production server that does not have ftp access. Possible way to
I have xml files been imported onto an FTP server. This is stored in
I have a file called generator.php that uses fwrite() to create a result.php on
I have an FTP batch file that uses DOS commands to pull down some
We have a ftp system setup to monitor/download from remote ftp servers that are
I have a FTP server setup that holds audio files in one of its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.