Re: How Do I Use An SSLServerSocket With ServerSocketChannel?
- From: Hal Vaughan <hal@xxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 27 Mar 2006 16:43:40 -0500
Daniel Dyer wrote:
On Mon, 27 Mar 2006 18:45:13 +0200, Hal Vaughan <hal@xxxxxxxxxxxxxxxxxxxx>
wrote:
This seems to be a tough subject. Whenever I ask questions about
sockets or
selectors or nonblocking io, it is difficult to get answers -- here or
elsewhere. Is there a reason for this? I've never had that kind of
trouble with other topics.
The reason is that it's not nearly as simple to do as you (and I) might
think it should be. It has only been possible since Java 5.0 and requires
some effort to get it working properly. The key class is SSLEngine
(http://java.sun.com/j2se/1.5.0/docs/api/javax/net/ssl/SSLEngine.html).
Found the articles. Unfortunately, I'm stuck with 1.4.2. If I upgrade to
1.5, I've got an entire application I've got to go through and upgrade to
compile on 1.5. While that will happen, I don't have time for it now.
(I'm not an early adopter!).
Okay, so one more question: I've seen programs that do close to what I'm
doing, which is echoing and/or forwarding the data from one port to the
next. One advantage to using non-blocking io (is nio short for
non-blocking io or network io?) is that it doesn't hog CPU time with
endless loops of reading a socket and writing to the other one while
there's nothing to write (as it keeps looping back checking for more data).
Am I right on that, or if I go back and re-write this under the older
style, so I loop and keep reading one inputstream and writing it to the
other socket's outputstream, isn't that going to steal a lot of CPU time
when there's no data coming in -- since it just keeps checking what's
available, getting a 0, then checking again?
This article seems to be the best place to start:
http://www.onjava.com/pub/a/onjava/2004/11/03/ssl-nio.html
Looks good -- but at this point, I still have to use 1.4.
Thanks, though.
Hal
.
- Follow-Ups:
- Re: How Do I Use An SSLServerSocket With ServerSocketChannel?
- From: Daniel Dyer
- Re: How Do I Use An SSLServerSocket With ServerSocketChannel?
- References:
- How Do I Use An SSLServerSocket With ServerSocketChannel?
- From: Hal Vaughan
- Re: How Do I Use An SSLServerSocket With ServerSocketChannel?
- From: Daniel Dyer
- How Do I Use An SSLServerSocket With ServerSocketChannel?
- Prev by Date: difference between String variable and String class definition
- Next by Date: Re: How Do I Use An SSLServerSocket With ServerSocketChannel?
- Previous by thread: Re: How Do I Use An SSLServerSocket With ServerSocketChannel?
- Next by thread: Re: How Do I Use An SSLServerSocket With ServerSocketChannel?
- Index(es):
Relevant Pages
|
|