title: (Are there) PERFORMANCE advantages of python socketserver over regular socket object?
body: <p>thanks for the interesting responses thus far.  In light of said responses I have changed my question a bit. </p>
  
  <p>guess what I really need to know is, is socketserver as opposed to the straight-up socket library designed to handle both periods of latency and stress, i.e. <strong>does it have additional mechanisms or features that justify its implicitly advertised status as a "server,"</strong> or is it just slightly easier to use?</p>
  
  <p>everyone seems to be recommending socketserver but I'm still not entirely clear why, as opposed to socket.</p>
  
  <p>thanks!!!</p>
  
  <blockquote>
    <p>I've built some server programs in
    python based on the standard socket
    library
    <a href="http://docs.python.org/library/socket.html">http://docs.python.org/library/socket.html</a></p>
    
    <p>I've noticed that they seem to work
    just fine  except that without load
    they have a tendency to go to sleep
    after a while.  I guess this may not
    be an issue in production (no doubt
    there will be plenty of other issues)
    but I <em>would</em> like to know if I am
    using the right code for the job here.</p>
    
    <p>Looking around I saw that python also
    provides a socketserver library -
    <a href="http://docs.python.org/library/socketserver.html">http://docs.python.org/library/socketserver.html</a></p>
    
    <p>The <em>socket</em> library provides the
    ability to listen for multiple
    connections, typically up to 5.</p>
    
    <p>According to the <em>socketserver</em> page,
    its services are synchronous, i.e.
    blocking, but one may support
    asynchronous behavior via threading. 
    I did notice it has the ability to
    maintain a request queue, with a
    default value of up to 5 requests...so
    maybe not much difference there.</p>
    
    <p>I have also read that Twisted runs
    socketserver under the hood.  Though I
    would rather not get into a beast the
    size of Twisted unless it's going to
    be worthwhile.</p>
    
    <p>so my question is, <strong>is socketserver
    more robust than socket?</strong> If so, why?</p>
    
    <p>(And how do you know?)  </p>
    
    <p>incidentally, is socketserver built on
    top of python's socket or is it
    entirely separate?  </p>
    
    <p>finally, as a bonus if anyone knows
    what one could do wrong such that
    standard sockets 'fall asleep' please
    feel free to chime in on that too.</p>
    
    <p>Oh, and I'm talking python 2.x rather
    than 3.x here if that makes a
    difference.</p>
    
    <p>thanks folks! </p>
    
    <p>jsh</p>
  </blockquote>
  
  <hr>
  
  <p>Well, I don't have a technical answer but I've implemented SocketServer per folks' recommendations and it IS definitely more reliable.  If anyone ever comes up with the low-level explanation please let me know...thanks! </p>