java Non blocking network programming time out issue -


I am writing the FTP server in Java using NIO non-blocking technology. I want to stop the user from connecting to my server and then do not want to do anything. Here is my code snippet:

  ServerSearchChannel Channel Server = (ServerSosset Channel) key.channel (); Socket channel socket channel = server channel Accept (); SocketChannel.socket () setSoTimeout (3000) SocketChannel.configureBlocking (wrong); .................... it does not work um ... is it possible to throw an exception when the user is nothing Does (like 15 minutes)?  

Thank you very much

socketChannel.socket (). SetSoTimeout (3000);

You did this, but then you put the channel in non-intercept mode, which prevents you from getting the exception of the deadline. If you are using non-intercept mode, and therefore possibly also select () , you will have to manage your time period.


Comments