behind the scenesthe transport has set up task on the event loop that is listening for incoming udp connections all we have to dothenis start the event loop running with the call to loop run_forever(so that task can process these packets when the packets arrivethey are processed on the protocol and everything just works the only other major thing to pay attention to is that transports (andindeedevent loopsare supposed to be closed when we are finished with them in this casethe code runs just fine without the two calls to close()but if we were constructing transports on the fly (or just doing proper error handling!)we' need to be quite bit more conscious of it you may have been dismayed to see how much boilerplate is required in setting up protocol class and underlying transport asyncio provides an abstraction on top of these two key concepts called streams we'll see an example of streams in the tcp server in the next example using executors to wrap blocking code asyncio provides its own version of the futures library to allow us to run code in separate thread or process when there isn' an appropriate non-blocking call to be made this essentially allows us to combine threads and processes with the asynchronous model one of the more useful applications of this feature is to get the best of both worlds when an application has bursts of / -bound and cpubound activity the / -bound portions can happen in the event-loop while the cpu-intensive work can be spun off to different process to illustrate thislet' implement "sorting as serviceusing asyncioimport asyncio import json from concurrent futures import processpoolexecutor def sort_in_process(data)nums json loads(data decode()curr while curr len(nums)if nums[curr>nums[curr- ]curr + elsenums[curr]nums[curr- nums[curr- ]nums[currif curr