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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:11:37+00:00 2026-05-12T22:11:37+00:00

Just for starters, I used Twisted and SocketServer with both ForkMixIn, ThreadMixIn and tried

  • 0

Just for starters, I used Twisted and SocketServer with both ForkMixIn, ThreadMixIn and tried the “thread-pool” recepies.

However, I wanted to make something particular work in Python.

Alittle background. Previously I wrote in C a simple TCP deamon that would bind to a socket and listen on it, then pre-fork X many times and then just pass the serversocket desc to all the forks and everyone would accept the clients very very marrily.

I checked out the “select/poll” based asyncore which I like alot. My only beef was that I could get a little CPU unbound by forking a few times to take advantage of the multi-cpu machine and hope for the best with scheduling.

I cant make it work for the life of me. Only 1 single instance can accept connections, all others simply throw an exception on handling the connect, ‘can not iterate thru Empty’.

is this even feasible? I checked alot, but I couldnt find ANY code for forking asyncore dispatchers (cry)

Thank you!

Update 1: (Full traceback as requested)

error: uncaptured python exception, closing channel <__main__.EchoServer listening 0.0.0.0:8001 at 0x2ad4880c93f8> (<type 'exceptions.TypeError'>:'NoneType' /python2.6/asyncore.py|readwrite|99] [/usr/local/python2.6.9/lib/python2.6/asyncore.py|handle_read_event|408] [./6py-server.py|handle_accept|87])

Always happens in accept, regardless if I fork before the asyncore.loop, etc.

Update 2: (full source)
pastebined source

  • 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-12T22:11:38+00:00Added an answer on May 12, 2026 at 10:11 pm

    You should use code markup for traceback, otherwise it’s displayed messed and we don’t see exception type.

    But I believe it’s TypeError: 'NoneType' object is not iterable since self.accept() can return None. The reason is that several processes can get read event for listening socket, but only one can accept it. The rest processes will get EWOULDBLOCK error which is caught, but then it returns None instead of connection-address pair.

    Change your handle_accept() to return immediately when accept() returns None.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just created a new project using the visual studio cordova starter template. However
Okay, just for starters, I am very new to Objective-C, (C in general). I
For starters this is homework, I just really need help with a binary search
I'm setting up Hadoop (0.20.2). For starters, I just want it to run on
I'm re-acquainting myself with Perl, and have just used module-starter to initialise a new
Having just started with MVC 2 I notice that in their starter template they
Just curious about what would be the django way of achieving the following :
just find gives me: . ./bla-bla_(11) ./bla-bla_(1) ./rename ./rename~ This find . | grep
Just getting started with backbone.js, and one of the things I've noticed is that
Just for fun, I've been using python and gstreamer to create simple Linux audio

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.