By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,779 Members | 1,101 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,779 IT Pros & Developers. It's quick & easy.

setSoTimeout in nonblocking mode?

P: n/a
I want to be throw exception when one thread wait to read no data from
a remote source for long time.

This can be done in pre-1.4 enviroment like the following.

---------------------------------------------------------------------------
Socket sock = new Sokcet("REMOTE_Addr", "REMOTE_port");
sock.setSoTimeout(10000);
InputStream in = sock.getInputStream();
in.read(); // If some data would not be read in 10000ms, exception
would be throwed..
---------------------------------------------------------------------------
But in nio of 1.4, how?
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
SPG
Exactly the same!!!!
"KimTaehwan" <ne******@cyber-r.com> wrote in message
news:75**************************@posting.google.c om...
I want to be throw exception when one thread wait to read no data from
a remote source for long time.

This can be done in pre-1.4 enviroment like the following.

-------------------------------------------------------------------------- - Socket sock = new Sokcet("REMOTE_Addr", "REMOTE_port");
sock.setSoTimeout(10000);
InputStream in = sock.getInputStream();
in.read(); // If some data would not be read in 10000ms, exception
would be throwed..
-------------------------------------------------------------------------- -

But in nio of 1.4, how?

Jul 17 '05 #2

P: n/a
nos
don't you need a channel?

"SPG" <st************@nopoo.blueyonder.co.uk> wrote in message
news:z1*********************@news-text.cableinet.net...
Exactly the same!!!!
"KimTaehwan" <ne******@cyber-r.com> wrote in message
news:75**************************@posting.google.c om...
I want to be throw exception when one thread wait to read no data from
a remote source for long time.

This can be done in pre-1.4 enviroment like the following.


--------------------------------------------------------------------------
-
Socket sock = new Sokcet("REMOTE_Addr", "REMOTE_port");
sock.setSoTimeout(10000);
InputStream in = sock.getInputStream();
in.read(); // If some data would not be read in 10000ms, exception
would be throwed..


--------------------------------------------------------------------------
-


But in nio of 1.4, how?


Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.