Tornado 6.5 Documentationwrite("Hello, world") def make_app(): return tornado.web.Application([ (r"/", MainHandler), ]) async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait() if __name__ == "__main__": RequestHandler which is subclassed to create web applications, and various supporting classes). • Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). • An asynchronous networking function: from tornado.httpclient import HTTPClient def synchronous_fetch(url): http_client = HTTPClient() response = http_client.fetch(url) return response.body And here is the same function rewritten asynchronously0 码力 | 272 页 | 1.12 MB | 3 月前3
Tornado 6.5 Documentationworld") def make_app(): return tornado.web.Application([ (r"/", MainHandler), ]) async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait()if __name__ HTTP server tornado.httpclient — Asynchronous HTTP client tornado.httputil — Manipulate HTTP headers and URLs tornado.http1connection – HTTP/1.x client/server implementation Asynchronous networking tornado (including RequestHandler which is subclassed to create web applications, and various supporting classes). Client- and server-side implementions of HTTP (HTTPServer and AsyncHTTPClient). An asynchronous networking0 码力 | 437 页 | 405.14 KB | 3 月前3
julia 1.10.10other operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int"CHAPTER 12. METHODS 160 12 package called Sockets. Let's first create a simple server: julia> using Sockets julia> errormonitor(@async begin server = listen(2000) while true sock = accept(server) println("Hello World\n") end end)0 码力 | 1692 页 | 6.34 MB | 3 月前3
Julia 1.10.9other operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int"CHAPTER 12. METHODS 160 12 package called Sockets. Let's first create a simple server: julia> using Sockets julia> errormonitor(@async begin server = listen(2000) while true sock = accept(server) println("Hello World\n") end end)0 码力 | 1692 页 | 6.34 MB | 3 月前3
Julia 1.11.4other operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int" 13.6 Design Patterns with package called Sockets. Let's first create a simple server: julia> using Sockets julia> errormonitor(@async begin server = listen(2000) while true sock = accept(server) println("Hello World\n") end end)0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.5 Documentationother operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int" 13.6 Design Patterns with package called Sockets. Let's first create a simple server: julia> using Sockets julia> errormonitor(@async begin server = listen(2000) while true sock = accept(server) println("Hello World\n") end end)0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.6 Release Notesother operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int" 13.6 Design Patterns with package called Sockets. Let's first create a simple server: julia> using Sockets julia> errormonitor(@async begin server = listen(2000) while true sock = accept(server) println("Hello World\n") end end)0 码力 | 2007 页 | 6.73 MB | 3 月前3
julia 1.12.0 beta1other operations that use f(x): julia> g(x) = f(x) g (generic function with 1 method) julia> t = @async f(wait()); yield(); Now we add some new methods to f(x): julia> f(x::Int) = "definition for Int" julia> g(1) "definition for Int" julia> fetch(schedule(t, 1)) "original definition" julia> t = @async f(wait()); yield(); julia> fetch(schedule(t, 1)) "definition for Int" 13.6 Design Patterns with and has to do with the accept and connect methods. The accept method retrieves a connection to the client that is connecting on the server we just created, while the connect function connects to a server0 码力 | 2047 页 | 7.41 MB | 3 月前3
Julia 1.12.0 RC1and has to do with the accept and connect methods. The accept method retrieves a connection to the client that is connecting on the server we just created, while the connect function connects to a server request was now available), accepted the connection, printed the message and waited for the next client. Reading and writing works in the same way. To see this, consider the following simple echo server: ractRemoteRef) if r.where > 0 # Check if the finalizer is already run if islocked(client_refs) || !trylock(client_refs) # delay finalizer for later if we aren't free to acquire the lock finalizer(finalize_ref0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta4and has to do with the accept and connect methods. The accept method retrieves a connection to the client that is connecting on the server we just created, while the connect function connects to a server request was now available), accepted the connection, printed the message and waited for the next client. Reading and writing works in the same way. To see this, consider the following simple echo server: ractRemoteRef) if r.where > 0 # Check if the finalizer is already run if islocked(client_refs) || !trylock(client_refs) # delay finalizer for later if we aren't free to acquire the lock finalizer(finalize_ref0 码力 | 2057 页 | 7.44 MB | 3 月前3
共 17 条
- 1
- 2













