Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Interruptible I/O for ObjectInputStream

Reply
Thread Tools

Interruptible I/O for ObjectInputStream

 
 
John English
Guest
Posts: n/a
 
      09-30-2005
Folks,
Can anyone tell me how to set matters up so that an ObjectInputStream
(connected to a socket) can be made to time out if nothing is available
to be read within a specified timeout period?

I'm using 1.4.2, BTW.

TIA,

----------------------------------------------------------------------
John English | (E-Mail Removed)
Senior Lecturer | http://www.it.bton.ac.uk/staff/je
School of Computing & MIS | "Those who don't know their history
University of Brighton | are condemned to relive it" (Santayana)
----------------------------------------------------------------------
 
Reply With Quote
 
 
 
 
Antti S. Brax
Guest
Posts: n/a
 
      09-30-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote in comp.lang.java.programmer:
> Can anyone tell me how to set matters up so that an ObjectInputStream
> (connected to a socket) can be made to time out if nothing is available
> to be read within a specified timeout period?


Have you tried Socket.setSoTimeout(int)?

--
Antti S. Brax Rullalautailu pitää lapset poissa ladulta
http://www.iki.fi/asb/ http://www.cs.helsinki.fi/u/abrax/hlb/

[1385 messages expunged from folder "Spam"]
 
Reply With Quote
 
 
 
 
John English
Guest
Posts: n/a
 
      09-30-2005
Antti S. Brax wrote:

> (E-Mail Removed) wrote in comp.lang.java.programmer:
>
>>Can anyone tell me how to set matters up so that an ObjectInputStream
>>(connected to a socket) can be made to time out if nothing is available
>>to be read within a specified timeout period?

>
>
> Have you tried Socket.setSoTimeout(int)?


Ah, of course -- silly me, I was worrying about the ObjectInputStream and
had forgotten that I can time out the socket...

Many thanks.

----------------------------------------------------------------------
John English | (E-Mail Removed)
Senior Lecturer | http://www.it.bton.ac.uk/staff/je
School of Computing & MIS | "Those who don't know their history
University of Brighton | are condemned to relive it" (Santayana)
----------------------------------------------------------------------
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      09-30-2005
On Fri, 30 Sep 2005 12:22:30 +0100, John English <(E-Mail Removed)>
wrote or quoted :

>Can anyone tell me how to set matters up so that an ObjectInputStream
>(connected to a socket) can be made to time out if nothing is available
>to be read within a specified timeout period?


see http://mindprod.com/timer.html

You can then on the tick check if nothing has happened since the last
tick.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      09-30-2005
On Fri, 30 Sep 2005 21:57:43 GMT, Roedy Green
<(E-Mail Removed) > wrote or quoted :

>see http://mindprod.com/timer.html


oops. Did it again. That should read:

http://mindprod.com/jgloss/timer.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
 
Reply With Quote
 
 
 
Reply

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
Making System.in interruptible, how? Jan Burse Java 9 03-12-2012 08:18 PM
How to convert a byte array to ObjectInputStream Ahmed Moustafa Java 5 11-16-2003 09:08 AM
Re: creating ObjectInputStream takes forever Roedy Green Java 2 08-05-2003 10:30 PM
Re: creating ObjectInputStream takes forever Lothar Kimmeringer Java 3 08-01-2003 04:46 AM
objectInputStream.readObject() does not work properly after certain period of inactivity. Serial # 19781010 Java 1 07-15-2003 10:20 PM



Advertisments