Interruptible I/O for ObjectInputStream

Discussion in 'Java' started by John English, Sep 30, 2005.

  1. John English

    John English Guest

    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:
    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)
    ----------------------------------------------------------------------
     
    John English, Sep 30, 2005
    #1
    1. Advertising

  2. 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"]
     
    Antti S. Brax, Sep 30, 2005
    #2
    1. Advertising

  3. John English

    John English Guest

    Antti S. Brax wrote:

    > 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 | mailto:
    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)
    ----------------------------------------------------------------------
     
    John English, Sep 30, 2005
    #3
  4. John English

    Roedy Green Guest

    On Fri, 30 Sep 2005 12:22:30 +0100, John English <>
    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.
     
    Roedy Green, Sep 30, 2005
    #4
  5. John English

    Roedy Green Guest

    Roedy Green, Sep 30, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Serial # 19781010
    Replies:
    1
    Views:
    718
    Roedy Green
    Jul 15, 2003
  2. Roedy Green
    Replies:
    2
    Views:
    331
    Roedy Green
    Aug 5, 2003
  3. Lothar Kimmeringer

    Re: creating ObjectInputStream takes forever

    Lothar Kimmeringer, Jul 31, 2003, in forum: Java
    Replies:
    3
    Views:
    610
    Blah Blah
    Aug 1, 2003
  4. Ahmed Moustafa
    Replies:
    5
    Views:
    12,729
    Gordon Beaton
    Nov 16, 2003
  5. Jan Burse
    Replies:
    9
    Views:
    550
    Arne Vajhøj
    Mar 12, 2012
Loading...

Share This Page