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


Groups > comp.lang.python > #33531 > unrolled thread

Re: Question on Socket Timeouts

Started byCameron Simpson <cs@zip.com.au>
First post2012-11-19 14:40 +1100
Last post2012-11-19 14:40 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Question on Socket Timeouts Cameron Simpson <cs@zip.com.au> - 2012-11-19 14:40 +1100

#33531 — Re: Question on Socket Timeouts

FromCameron Simpson <cs@zip.com.au>
Date2012-11-19 14:40 +1100
SubjectRe: Question on Socket Timeouts
Message-ID<mailman.3810.1353296464.27098.python-list@python.org>
On 18Nov2012 03:27, Abhijeet Mahagaonkar <abhi.forall@gmail.com> wrote:
| I'm new to network programming.
| I have a question.
| 
| Can we set a timeout to limit how long a particular socket can read or
| write?

On the socket itself? Probably not. But...

| I have used a settimeout() function.
| The settimeout() works fine as long as the client doesnt send any data for
| x seconds.
| The data that I receive in the server after accept()ing a connect() from a
| client I check if the client is sending any invalid data.
| I'm trying to ensure that a client sending invalid data constantly cannot
| hold the server. So is there a way of saying I want the client to use this
| socket for x seconds before I close it, no matter what data I receive?

Not the time you set up the socket, or when you accept the client's
connection. Thereafter, ever time you get some data, look at the clock.
If enough time has elapsed, close the socket yourself.

So, not via an interface to the socket but as logic in your own code.

Cheers,
-- 
Cameron Simpson <cs@zip.com.au>

Their are thre mistakes in this sentence.
        - Rob Ray DoD#33333 <rray@linden.msvu.ca>

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web