Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.028 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'cache': 0.07; 'dns,': 0.09; 'lookup': 0.09; 'rfc': 0.09; 'subject:skip:c 10': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'wrote': 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'here).': 0.16; 'tcp': 0.16; 'wrote:': 0.18; 'module': 0.19; 'cc:addr:python.org': 0.22; 'parse': 0.24; 'server.': 0.24; 'cc:2**0': 0.24; 'source': 0.25; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'possibility': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'easier': 0.31; 'requests': 0.31; 'prevention': 0.31; 'probably': 0.32; 'open': 0.33; 'fri,': 0.33; 'maybe': 0.34; 'received:google.com': 0.35; 'smtp': 0.36; 'doing': 0.36; 'too': 0.37; 'two': 0.37; 'starting': 0.37; 'implement': 0.38; 'rather': 0.38; 'does': 0.39; 'easy': 0.60; 'pick': 0.64; 'more': 0.64; 'talking': 0.65; 'home': 0.69; 'yourself': 0.78; 'asynchronous': 0.84; 'everything.': 0.84; 'roads': 0.91; 'to:none': 0.92; 'hands': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=uZleBJUX+m7Dw2dizKrfMDrU3V1N7CNu+Sv6jAD8/wc=; b=YmNQxhj3m420uPJVMI8dwGZzPbk4TwZs98HlDgZhrJYaNI0kjhuxTHg3xo4orpTrdi 24haRfF7lnlnoX6wHP1ZQYJfudvaBmXfhhriPUElxw1Vr+m1/sgqXyirLRqEids+6Nph iLRTDgM2lHNSijyfEtYWuSenuToqsaImLC78/pLSDEujGCGtdHEx7tmOG5gZ3rIxdAcs kFN9Kl+qgQjSXDO046TH19TbQfTuMU4+OCMvzU/ycUK6zVSddJfFPyQn0+LLCrkMDZrh B/+a7/mmnqGLZufK76+a+8Ms5mWlc8txqFA3LZD8kFj25b36tiSP7HifTFRh5e++wQTv LkQA== MIME-Version: 1.0 X-Received: by 10.52.74.196 with SMTP id w4mr2348892vdv.19.1399597977564; Thu, 08 May 2014 18:12:57 -0700 (PDT) In-Reply-To: <87tx90t5q8.fsf@elektro.pacujo.net> References: <536BD338.4070004@andros.org.uk> <87tx90t5q8.fsf@elektro.pacujo.net> Date: Fri, 9 May 2014 11:12:57 +1000 Subject: Re: Real-world use of concurrent.futures From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399597980 news.xs4all.nl 2903 [2001:888:2000:d::a6]:43179 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71143 On Fri, May 9, 2014 at 5:45 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> 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