Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Question on Socket Timeouts

Thread Tools

Re: Question on Socket Timeouts

Cameron Simpson
Posts: n/a
On 18Nov2012 03:27, Abhijeet Mahagaonkar <(E-Mail Removed)> 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.

Cameron Simpson <(E-Mail Removed)>

Their are thre mistakes in this sentence.
- Rob Ray DoD#33333 <(E-Mail Removed)>
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Question on Socket Timeouts Cameron Simpson Python 0 11-19-2012 05:37 AM
socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 1 01-27-2009 05:05 PM
Re: socket.unbind or socket.unlisten? - socket.error: (48,'Address already in use') Jean-Paul Calderone Python 0 01-27-2009 01:41 PM
forms authentication timeouts and session timeouts =?Utf-8?B?SmFzb24=?= ASP .Net 0 06-22-2004 09:24 AM
Session-Timeouts and Idle-Timeouts on AS5300 and AS5800 Matt Cisco 1 02-17-2004 06:59 PM