Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2005

Tip: Looking for answers? Try searching our database.

Interruptible I/O for ObjectInputStream

Thread view: 
John English - 30 Sep 2005 12:21 GMT
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              | mailto:je@brighton.ac.uk
 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)
----------------------------------------------------------------------
Antti S. Brax - 30 Sep 2005 12:50 GMT
je@brighton.ac.uk 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)?

Signature

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"]

John English - 30 Sep 2005 15:44 GMT
> je@brighton.ac.uk wrote in comp.lang.java.programmer:
>
[quoted text clipped - 3 lines]
>
>     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              | mailto:je@brighton.ac.uk
 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)
----------------------------------------------------------------------
Roedy Green - 30 Sep 2005 22:57 GMT
>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.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Roedy Green - 30 Sep 2005 22:58 GMT
>see http://mindprod.com/timer.html

oops. Did it again. That should read:

http://mindprod.com/jgloss/timer.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.