Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'socket': 0.05; '21,': 0.07; 'parameter': 0.07; 'referring': 0.07; 'python': 0.09; 'subject:Source': 0.09; 'underlying': 0.09; 'suggest': 0.11; '(note': 0.16; 'bind': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'function?': 0.16; 'hello:': 0.16; 'imap4': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'specify': 0.17; 'received:209.85.214.174': 0.21; 'machine': 0.24; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'separate': 0.27; 'message-id:@mail.gmail.com': 0.27; 'interface': 0.27; 'this?': 0.28; 'run': 0.28; 'source': 0.29; 'url:python': 0.32; 'could': 0.32; 'docs': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'nov': 0.35; 'received:209.85': 0.35; 'url:org': 0.36; 'url:library': 0.36; 'client': 0.36; 'address.': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'address': 0.60; 'subject:Client': 0.84 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:to :content-type; bh=PGxeQedLWitA5n3CxEjlEzcNZlIdsHlMhy01dJy2Znk=; b=gfGQz5Jqmkm+uwXOJZ4H5dEU4clFdupXfIk/08Z9OY24ylpkVb6qwRqDv3NdfSHWUN Z9vMhJD7WtBlj1ZbfTbSSvv+7rM9GTZpESxAFKVJiYlAaBX40uiEGmzJqUOW0rcjCbmj 29DUC9LbRJLLaiuzLV4e6oI3eRv6hEqPwFhKmCRzeaPgkaHmuaXTw2fijGrjD6khSP5O kxAzL1jBorUwjIGZKrlXsY5IIXBSTpG9R51IezVAjbaGVnnzRHHhyGjQz8WU0zaJlxW5 In9xUVgUOzjgtkneGD8P2detk/+VNVZFXCPRHGCxdDCkdBpcrZwR3/WTy/oe44/54dDo 0q/g== MIME-Version: 1.0 In-Reply-To: <72731eb3-1521-46f0-8601-8a2df58849d8@googlegroups.com> References: <72731eb3-1521-46f0-8601-8a2df58849d8@googlegroups.com> Date: Wed, 21 Nov 2012 08:47:55 +1100 Subject: Re: Choosing Source Address to Bind Socket to in IMAP Client 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.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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1353448083 news.xs4all.nl 6877 [2001:888:2000:d::a6]:45741 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33667 On Wed, Nov 21, 2012 at 8:14 AM, wrote: > Hello: > > I have a multihomed machine that I would like to run the Python imaplib's IMAP4 client on. I would like to be able to specify which interface the underlying socket will bind to as its source address. How could I best do this? You're referring to this function? http://docs.python.org/3.3/library/imaplib.html#imaplib.IMAP4 The docs suggest that you can simply pass it a parameter to specify the address to bind to. (Note that you bind to addresses, not interfaces. Figuring out which interface has which address is a separate issue.) ChrisA