子敬正在创造自己的人生
需求有轻重缓急,功能有可控不可控。 需求有版本有截止(否则会无休无止),功能不可控变为可控。 集中兵力消灭敌人有生力量,集中优势兵力消灭敌人有生力量。

// Accept the connection and make it non-blocking
SocketChannel socketChannel = serverSocketChannel.accept();
Socket socket = socketChannel.socket();
//socket.setSoTimeout(1000*10);//it will be timeout if idle more than 10s
//after testing, i found the parameter in socketchannel didnot work
//the following is what i google:
//you don't need a timeout,
//because SC's (SC means SocketChannel) do a non-blocking Connect, and send a message to the Selector with message type CONNECTED when that becomes the case

//in the protosocket, read method is a blocking invocation, so it need a "timeout" parameter ,in case some evil connection

 

posted on 2014-02-11 10:36  silentjesse  阅读(342)  评论(0)    收藏  举报