Answer the question
In order to leave comments, you need to log in
Why is asynchronous http server not accepting connections?
Good day. Just started to deal with asynchronous programming in Python 3.
It is necessary to implement a client-server application:
1. The client gets to the server, receives from it in response the connection settings (port, number of files, format) in json format via http
2. By sending these settings, the server creates a socket on the port that it sent to the client and waits for it to connect and accept files in the required quantity and formats, while continuing to register other connected to free ports.
import tornado.ioloop
import tornado.web
import time
def looper():
time.sleep(10)
class MainHandler(tornado.web.RequestHandler):
def get(self, *args, **kwargs):
self.write('hello')
self.finish()
looper()
def app():
return tornado.web.Application([
(r'/', MainHandler),
])
if __name__ == "__main__":
app = app()
app.listen(8888)
tornado.ioloop.IOLoop.current().start()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question