i want to create a python socket server to send and get data to html5 ,
what is the best way to do it , a python socket lib ? or a simple code ?
thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
@srgerg’s socket documentation is useful, but if you want to handle multiple sockets simultaneously, you’ll also need other mechanisms, such as
select,epoll, orkqueue(depending upon your platform). (You could also spawn multiple processes usingfork, or threads if the python threading implementation meets your needs, but both these approaches have enough complications that I’m reluctant to suggest them.)Another approach is to use Twisted to manage your networking via an event loop, similar to using libevent, but I always found Twisted documentation difficult to follow. Maybe you will have better luck than I did.