Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33678

RE: Choosing Source Address to Bind Socket to in IMAP Client

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ramit.prasad@jpmorgan.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'argument': 0.04; 'socket': 0.05; 'completeness': 0.07; 'override': 0.07; 'python': 0.09; 'received:155': 0.09; 'subclass': 0.09; 'subject:Source': 0.09; 'underlying': 0.09; 'cc:addr:python-list': 0.10; 'bind': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'imap4': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:159.53.110': 0.16; 'received:159.53.110.174': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:sj2.jpmchase.com': 0.16; 'received:svr.bankone.net': 0.16; 'securities,': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.17; 'specify': 0.17; 'question.': 0.20; 'object.': 0.22; 'cc:2**0': 0.23; 'received:169.254': 0.24; 'machine': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'skip:" 20': 0.26; 'accuracy': 0.27; 'interface': 0.27; 'this?': 0.28; 'fine': 0.28; 'run': 0.28; 'received:169': 0.29; 'source': 0.29; 'connection': 0.30; 'url:python': 0.32; 'help,': 0.32; 'could': 0.32; 'third': 0.34; 'programming.': 0.35; 'url:org': 0.36; 'url:library': 0.36; 'client': 0.36; 'charset:us-ascii': 0.36; 'address.': 0.36; 'subject:: ': 0.38; 'url:docs': 0.38; 'your': 0.60; 'helps': 0.63; 'information': 0.63; 'information,': 0.63; 'url:email': 0.63; 'more': 0.63; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'sale': 0.76; 'received:169.254.8': 0.84; 'subject:Client': 0.84
X-DKIM OpenDKIM Filter v2.1.3 sj2.jpmchase.com qAKMfHC9014646
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1353451278; bh=c23LySbDsBB+AdP/4eyD9SI7VmHbtXGK+DwplgdfjFM=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=BKfIiId4KTJm8oD/TR5qiRoVHRLLtaJsAR+1lJoSAi2s5Ld4vBJbd1BiTV0NEP4YK 6JDM49Df7RWbrqcrfMw2LI4z7v9Sq6tSkJMtsq67Fy6Ysirs4ILzWlo3aVIbPyLc+s RLsdlhMeGym0ph6RX1qn73wOGlYE+VGHg4ETQjYk=
From "Prasad, Ramit" <ramit.prasad@jpmorgan.com>
To "brintoul@controlledthinking.com" <brintoul@controlledthinking.com>
Subject RE: Choosing Source Address to Bind Socket to in IMAP Client
Thread-Topic Choosing Source Address to Bind Socket to in IMAP Client
Thread-Index AQHNx2wh2PneXNU4Eki5xNtcfprKPJfzTHJQ
Date Tue, 20 Nov 2012 22:41:13 +0000
References <72731eb3-1521-46f0-8601-8a2df58849d8@googlegroups.com> <mailman.105.1353448752.29569.python-list@python.org> <ff63b325-4295-43c9-aa07-488a581ce5aa@googlegroups.com>
In-Reply-To <ff63b325-4295-43c9-aa07-488a581ce5aa@googlegroups.com>
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-originating-ip [10.67.79.47]
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-DLP-FWD Yes
Content-Type text/plain; charset="us-ascii"
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.112.1353451280.29569.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1353451280 news.xs4all.nl 6847 [2001:888:2000:d::a6]:40216
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33678

Show key headers only | View raw


brintoul@controlledthinking.com wrote:
> > > 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?
[snip]

> While I appreciate your attempt at humor, this is not information which helps me.  Perhaps you are not familiar
> with the basics of socket programming. This is all fine and dandy, and it is good to "know what you don't know".
> If you're interested, look at the third argument to "create_connection":
> http://docs.python.org/2/library/socket.html

Apologies, I misread your question. 

According to the imaplib docs, you can subclass IMAP4 and override 
`IMAP4.open` to create the socket and bind it to the desired interface.
You could also connect using IMAP4 and then close/reopen the socket
inside the IMAP4 connection object. 


I hope that is more help,
Ramit


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Choosing Source Address to Bind Socket to in IMAP Client brintoul@controlledthinking.com - 2012-11-20 13:14 -0800
  Re: Choosing Source Address to Bind Socket to in IMAP Client Chris Angelico <rosuav@gmail.com> - 2012-11-21 08:47 +1100
    Re: Choosing Source Address to Bind Socket to in IMAP Client brintoul@controlledthinking.com - 2012-11-20 14:00 -0800
      Re: Choosing Source Address to Bind Socket to in IMAP Client Chris Angelico <rosuav@gmail.com> - 2012-11-21 09:35 +1100
    Re: Choosing Source Address to Bind Socket to in IMAP Client brintoul@controlledthinking.com - 2012-11-20 14:00 -0800
  RE: Choosing Source Address to Bind Socket to in IMAP Client "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-20 21:58 +0000
    Re: Choosing Source Address to Bind Socket to in IMAP Client brintoul@controlledthinking.com - 2012-11-20 14:12 -0800
      RE: Choosing Source Address to Bind Socket to in IMAP Client "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-20 22:41 +0000
        Re: Choosing Source Address to Bind Socket to in IMAP Client brintoul@controlledthinking.com - 2012-11-20 14:55 -0800
          RE: Choosing Source Address to Bind Socket to in IMAP Client "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-20 23:10 +0000
        Re: Choosing Source Address to Bind Socket to in IMAP Client brintoul@controlledthinking.com - 2012-11-20 14:55 -0800
    Re: Choosing Source Address to Bind Socket to in IMAP Client brintoul@controlledthinking.com - 2012-11-20 14:12 -0800

csiph-web