Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24436
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <drsalists@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.019 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'explicitly': 0.05; 'messages.': 0.05; 'received:209.85.160.174': 0.07; 'socket': 0.07; 'subject:How': 0.09; 'subject:setting': 0.09; 'cc:addr :python-list': 0.10; 'subject:python': 0.12; 'subject:alive': 0.16; 'subject:ever': 0.16; 'url:shtml': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'all,': 0.21; 'detect': 0.22; 'programming': 0.22; 'checking': 0.23; 'header:In-Reply-To:1': 0.23; '8bit%:5': 0.26; 'message-id:@mail.gmail.com': 0.27; 'cc:2**0': 0.27; 'error': 0.28; 'cc:no real name:2**0': 0.28; 'skip:s 30': 0.28; 'cc:addr:python.org': 0.29; 'url:7': 0.29; 'url:network': 0.29; 'url:mailman': 0.29; 'code': 0.31; 'url:python': 0.31; 'connection': 0.32; 'url:listinfo': 0.33; 'gets': 0.33; 'open': 0.34; 'received:google.com': 0.34; 'add': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'url:org': 0.35; 'ability': 0.36; 'subject:: ': 0.37; 'received:209': 0.37; 'some': 0.38; 'pm,': 0.38; 'end': 0.38; 'build': 0.39; 'header:Received:5': 0.39; 'keep': 0.61; 'to:addr:gmail.com': 0.62; 'relatively': 0.63; 'here': 0.65; 'close': 0.67; 'url:4': 0.70; 'connection.': 0.72; 'encounters': 0.84; 'subject:Keep': 0.84; 'subject:keep': 0.91; 'trouble.': 0.91; 'responses': 0.93 |
| 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 :cc:content-type:content-transfer-encoding; bh=xmzUrKSPgIONP3984GYvcR3y4RcUvPBhuAmltImBges=; b=l1QylhN7dvgcBd6Q7+hCqsGC0PrAgCldp8hTZYPDbCUUl2us3e9Bm6BTE7y4tiLDLM kHrgZGTt7+/WfFOHwnZF88fLNpoElo1nit+0a6v6YL6RdVZv4YH6/WNlsddHr3q1O7cs fNJz8961dikpQdjojKDp+Cz1R5A4WeuZG0Rs8i1Wco+xkUeVUNzJBPJ5rhC61IUqALOi ncBdkPFnw6jHeu3DhsLIouXyzsq3IGdOd3I4I/QLqMjYWoxGeYNMAY0KC7aJH145R4ai 7xZLcDAvKDq6U29iPWLIFTtLrLqu1ad9suXsky91B8lwMQyy1iZZVs+feJelelIJI2eu 18IA== |
| MIME-Version | 1.0 |
| In-Reply-To | <44c35921-ff32-4e80-b8fd-4dd2f3960a21@googlegroups.com> |
| References | <44c35921-ff32-4e80-b8fd-4dd2f3960a21@googlegroups.com> |
| Date | Mon, 25 Jun 2012 17:30:41 +0000 |
| Subject | Re: How keep python socket alive for ever by setting Keep alive flag. |
| From | Dan Stromberg <drsalists@gmail.com> |
| To | hisan <santosh.ssit@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.1492.1340645444.4697.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1340645444 news.xs4all.nl 6955 [2001:888:2000:d::a6]:46145 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:24436 |
Show key headers only | View raw
http://www.unixguide.net/network/socketfaq/4.7.shtml It's better to add the ability to recreate a socket if it encounters trouble. SO_KEEPALIVE is there to help you detect if the other end of your connection has disappeared. Network programming has relatively few absolutes - it's best to build in error checking and sometimes, error responses that go beyond mere error messages. On Mon, Jun 25, 2012 at 5:21 PM, hisan <santosh.ssit@gmail.com> wrote: > Hi All, > > I want to open a socket connection and keep it alive for ever or until i explicitly close the socket connection. > > below is my code though i have set keep alive flag the socket gets closed after some time .please help me out here > > sb_sock = socket.socket(socket.AF_INET, > socket.SOCK_STREAM,socket.SOL_TCP) > sb_sock.setsockopt( socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) > sb_sock.connect((msg_host, host_port)) > sb_sock.send(reg_msg) > -- > http://mail.python.org/mailman/listinfo/python-list
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
How keep python socket alive for ever by setting Keep alive flag. hisan <santosh.ssit@gmail.com> - 2012-06-25 10:21 -0700 Re: How keep python socket alive for ever by setting Keep alive flag. Dan Stromberg <drsalists@gmail.com> - 2012-06-25 17:30 +0000
csiph-web