(Are there) PERFORMANCE advantages of python socketserver over regular socket object? -


thanks interesting responses far. in light of said responses have changed question bit.

guess need know is, socketserver opposed straight-up socket library designed handle both periods of latency , stress, i.e. does have additional mechanisms or features justify implicitly advertised status "server," or easier use?

everyone seems recommending socketserver i'm still not entirely clear why, opposed socket.

thanks!!!

i've built server programs in python based on standard socket library http://docs.python.org/library/socket.html

i've noticed seem work fine except without load have tendency go sleep after while. guess may not issue in production (no doubt there plenty of other issues) would know if using right code job here.

looking around saw python provides socketserver library - http://docs.python.org/library/socketserver.html

the socket library provides ability listen multiple connections, typically 5.

according socketserver page, services synchronous, i.e. blocking, 1 may support asynchronous behavior via threading. did notice has ability maintain request queue, default value of 5 requests...so maybe not difference there.

i have read twisted runs socketserver under hood. though rather not beast size of twisted unless it's going worthwhile.

so question is, is socketserver more robust socket? if so, why?

(and how know?)

incidentally, socketserver built on top of python's socket or entirely separate?

finally, bonus if knows 1 wrong such standard sockets 'fall asleep' please feel free chime in on too.

oh, , i'm talking python 2.x rather 3.x here if makes difference.

thanks folks!

jsh


well, don't have technical answer i've implemented socketserver per folks' recommendations , more reliable. if ever comes low-level explanation please let me know...thanks!

the socket module low-level module sending , receiving packets. said in documentation, "provides access bsd socket interface".

if want more elaborate, there "socketserver" takes care of gory details you, but still relatively low level.

on top of can find http server, or without cgi, xml-rpc server, , on. these frameworks, means code calls code. makes things simpler because have fill "gaps" have working server, means have little bit less control on does.

if need features of socketserver, go it, unless want reinvent wheel reason (and there reasons design new wheels, example understand how works).


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -