Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'chooses': 0.07; 'lately': 0.09; 'subject:()': 0.09; 'subject:addresses': 0.09; 'wifi': 0.09; 'am,': 0.12; 'hopefully': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lan': 0.16; 'reliability.': 0.16; 'unix/linux,': 0.16; 'mon,': 0.16; 'wrote:': 0.16; "wouldn't": 0.17; 'trying': 0.21; 'result.': 0.21; 'header:In- Reply-To:1': 0.22; 'interface': 0.23; 'wondered': 0.23; 'aug': 0.24; 'windows': 0.26; 'function': 0.27; 'message- id:@mail.gmail.com': 0.29; '22,': 0.30; 'config': 0.30; "didn't": 0.31; 'usually': 0.32; 'to:addr:python-list': 0.33; 'instead': 0.33; "i've": 0.34; 'dns': 0.34; 'explicit': 0.34; 'trouble': 0.35; 'connection': 0.36; 'file': 0.36; 'fair': 0.37; 'interface.': 0.37; 'using': 0.37; 'configured': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'getting': 0.39; "there's": 0.39; 'why': 0.39; 'to:addr:python.org': 0.39; 'wireless': 0.40; 'degree': 0.40; 'your': 0.61; 'cameron': 0.67; 'kept': 0.68; 'connection,': 0.73; 'order,': 0.73; 'subject:Order': 0.77; 'gateway,': 0.84; 'subject:skip:s 20': 0.91; 'insane': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=YdJVbQPUmdtOJJu24faDMHYhOK+ic6n8Ul4tzgGruTs=; b=wxE02G2ePqY0Ylv8MZrQnvyR3g1EjwZ5UzJ3qjf82te0A3vy4lQx60MlrAr2h/OAiI cyFPPrHKAdYDz5RGbn5Q0NFJ7cQAZ9GxKQ+xf4mNX0oHtua4SPRLIByzVfbA205lFnMe +DmOpKZFUu2TjoEBge84njmezARyvO8sSNZHk= MIME-Version: 1.0 In-Reply-To: <20110822100646.GA24782@cskk.homeip.net> References: <20110822100646.GA24782@cskk.homeip.net> Date: Mon, 22 Aug 2011 11:36:12 +0100 Subject: Re: Order of addresses returned by socket.gethostbyname_ex() From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1314009375 news.xs4all.nl 23835 [2001:888:2000:d::a6]:47282 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12007 On Mon, Aug 22, 2011 at 11:06 AM, Cameron Simpson wrote: > What if you queried your routing table instead? Usually there's just one > default route, and hopefully it would be configured to use the "best" > interface. > I wouldn't necessarily trust even this, on Windows. I've lately had the most insane trouble getting my XP laptop to function properly as a proxy - LAN connection has the default gateway, wifi has only 192.168.* - and Windows kept on trying to send DNS queries out on the wireless connection, and then wondered why it didn't get a result. Explicit is better than implicit. Instead of using the order, have a config file that chooses the one(s) you want by name or IP address. Of course, if you're on Unix/Linux, you can use the interface name (eth0, eth1, etc) with a fair degree of reliability. ChrisA