Real-world use of concurrent.futures

Chris Angelico rosuav at gmail.com
Thu May 8 21:12:57 EDT 2014


On Fri, May 9, 2014 at 5:45 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> Before you go too far down roads that are starting to look
>> problematic: A DNS lookup is a UDP packet out and a UDP packet in
>> (ignoring the possibility of TCP queries, which you probably won't be
>> doing here). Maybe it would be easier to implement it as asynchronous
>> networking? I don't know that Python makes it easy for you to
>> construct DNS requests and parse DNS responses;
>
> That's what I ended up doing when I wrote my home SMTP server.
>
> It's more tedious than difficult. You don't need to have a ready-made
> module for everything. An RFC and two hands take you far.

Be careful. A naive implementation can open you up to various security
issues. In the case of DNS, source port randomization is important to
the prevention of cache poisoning; if you don't know what I'm talking
about, pick a language/library that does the work for you, rather than
doing everything yourself :)

ChrisA



More information about the Python-list mailing list