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 3346612
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:19:29+00:00 2026-05-18T01:19:29+00:00

is there a way to check connection is established in asyncore? once asyncore.loop() is

  • 0

is there a way to check connection is established in asyncore?

once asyncore.loop() is called, how can I disconnect the communication between server?

can i just simply call close()?

  • 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-05-18T01:19:29+00:00Added an answer on May 18, 2026 at 1:19 am

    Once asyncore.loop() is called, the control is handed over to event loop that runs.

    Any code after the asyncore.loop() will be called only after the event loop has been shut down.

    Event loop will react to various events and call handlers. To shutdown the event loop, you must call to stop in one of the event handler where it makes sense.

    For ex: Take a look at the following example.

    Code from : http://www.mechanicalcat.net/richard/log/Python/A_simple_asyncore__echo_server__example

    import asyncore, socket
    
    class Client(asyncore.dispatcher_with_send):
        def __init__(self, host, port, message):
            asyncore.dispatcher.__init__(self)
            self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
            self.connect((host, port))
            self.out_buffer = message
    
        def handle_close(self):
            self.close()
    
        def handle_read(self):
            print 'Received', self.recv(1024)
            self.close()
    
    c = Client('', 5007, 'Hello, world')
    asyncore.loop()
    

    self.close is called inside one of the event handler – handle_read. In this case after the data has been received from the server. it disconnects itself.

    References:

    • http://effbot.org/librarybook/asyncore.htm
    • http://pymotw.com/2/asyncore/index.html#module-asyncore
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do you check if there is an internet connection using jQuery? That way
Is there any way to check the connection leakage in a Java EE application?
Possible Duplicate: Check connection is active in ASP.NET Is there a way in ASP.NET
Is there a way to check in ant if an internet connection is available.
Is there any way to check the status of the RPC connection from the
Is there any way I can check in/out of a local repository, and have
Is there any way to check whether a file is locked without using a
Is there a way to check if a file has been opened by ReWrite
Is there a way to check to see if a date/time is valid you
Is there any way to check if a given index of an array exists?

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.