Re: How Do I Use An SSLServerSocket With ServerSocketChannel?



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
.



Relevant Pages

  • Re: aio_read/write versus O_NONBLOCK
    ... impose an implementation (eg one with a per-file write buffer) that is, ... there's generally no reason to wait to start to the ... For sockets, there's no logical reason you might want to wait to be ... So an AIO mechanism basically *is* the equivalent of the socket non- ...
    (comp.unix.programmer)
  • Re: STILL NEED MY 1200 XL COMPUTER!!!!
    ... > an 800XL where one of the 40 pin chips went out, ... any desire to mod my 130XE after I opened it up and found 0 sockets. ... > chip or two more then an 800XL but has a huge footprint. ... > Bob's mods are a major reason to use a 1200XL. ...
    (comp.sys.atari.8bit)
  • Re: How Do I Use An SSLServerSocket With ServerSocketChannel?
    ... it's Java 5.0 or give up. ... Your threads, will be idle when the sockets are idle. ... isn't that going to steal a lot of CPU time ...
    (comp.lang.java.help)
  • Re: SBS 2K3 and WINS
    ... we have SBS 2k3 Standart R2 in our company. ... Is there any reason why ... should WINS service take 25% of CPU time whole day? ...
    (microsoft.public.windows.server.sbs)
  • Re: [SLE] "top" command consuming lots of CPU...
    ... > What could be the reason for "top" consuming about 80% of CPU time ... > 9.0 Pro) ...
    (SuSE)