Socket write timeout
843790Apr 5 2009 — edited Apr 5 2009How 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.