How to interrupt SSLServerSocket.accept()?

Hi all,

I have created a simple SSL Server socket, and I called 'accept()' in a separate thread, however, this method cannot be interrupted with Thread.interrupt(). It just blocks and stays that way. For non-SSL sockets, I know I can use channels, but I could not find the SSL-equivalent implementation.

Any ideas how to imlement an interruptible SSL server socket?

[386 byte] By [sagmana] at [2007-11-26 13:29:24]
# 1
Read chapter 8 of the book: http://www.telekinesis.com.au/wipv3_6/FundamentalNetworkingInJava.A21
hiwaa at 2007-7-7 20:33:43 > top of Java-index,Core,Core APIs...
# 2
> Any ideas how to imlement an interruptible SSL server> socket?You mean you just want to stop it from accepting?Why don't you just close it?
jschella at 2007-7-7 20:33:43 > top of Java-index,Core,Core APIs...
# 3

There is no SSLServerSocketChannel apart from my product at http://www.telekinesis.com.au, but you only need to set a timeout on the SSLServerSocketChannel. This will cause accept() to throw a SocketTimeoutException, and every time it does it can inspect the Thread.isInterrupted() flag. How long the timeout should be is up to you, i.e. how quickly you need the interrupt to take effect.

ejpa at 2007-7-7 20:33:43 > top of Java-index,Core,Core APIs...