Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Socket write timeout

843790Apr 5 2009 — edited Apr 5 2009
How do you get a blocked write on a socket to timeout?

I've written a simple test program that has two threads, one is the server that accepts a connection form the other that is the client. Once the client has established a connection, the server thread starts writing to the output steam of the socket. The client doesn't attempt to read any of the incoming data. I have set the SO_TIMEOUT option on the socket to 5 seconds. The server quickly fills the output buffer and blocks on the write call. And that's where is sits even after the 5 second timout has elapsed. I've tried a similar test on the read operation and the timeout works just fine.

I'm using JDK 1.6.0_05.

Any thoughts... am I missing something? Does the timeout only apply to the read operation and not the write?

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 3 2009
Added on Apr 5 2009
1 comment
668 views