E
EdwardH
I've been trying to convert my ftp server (iftpd.sf.net) from normal
Sockets to NIO, and it's been working fine so far. Now I have to figure
out how to do SSL with NIO.
I've understood the wrap() and unwrap() and handshaking this and that.
I've also read that some functions need time to complete, and therefore
one needs to wait for a task to complete, like below...
Receive data
Flip bytebuffer
result = Unwrap
if (result.getHandshakeStatus() ==
SSLEngineResult.HandshakeStatus.NEED_TASK)
{
Runnable task = sslEngine.getDelegatedTask();
try
{
while ( task != null )
task.run();
}
catch (Exception e)
{
}
}
The problem is that the task never finishes. It just waits and waits.
I've tried wrapping more data before running the task, I've tried
sending unwrapped data, I've tried ignoring the need to run the task,
but nothing works.
Anyone know what the problem could be?
For those familiar with FTP: The conversion from a SocketChannel to an
SSLed SocketChannel is done right after sending the "234 AUTH TLS OK"
reply to the client. I receive 90 bytes directly afterwards which I then
unwrap and find out that I have to let the task run...
Sockets to NIO, and it's been working fine so far. Now I have to figure
out how to do SSL with NIO.
I've understood the wrap() and unwrap() and handshaking this and that.
I've also read that some functions need time to complete, and therefore
one needs to wait for a task to complete, like below...
Receive data
Flip bytebuffer
result = Unwrap
if (result.getHandshakeStatus() ==
SSLEngineResult.HandshakeStatus.NEED_TASK)
{
Runnable task = sslEngine.getDelegatedTask();
try
{
while ( task != null )
task.run();
}
catch (Exception e)
{
}
}
The problem is that the task never finishes. It just waits and waits.
I've tried wrapping more data before running the task, I've tried
sending unwrapped data, I've tried ignoring the need to run the task,
but nothing works.
Anyone know what the problem could be?
For those familiar with FTP: The conversion from a SocketChannel to an
SSLed SocketChannel is done right after sending the "234 AUTH TLS OK"
reply to the client. I receive 90 bytes directly afterwards which I then
unwrap and find out that I have to let the task run...