/**
* (c) 2011 tkuri (since 2011-7-1)
*/
package tkuri.jxy;
import java.net.InetSocketAddress;
import java.nio.channels.SelectionKey;
import java.nio.channels.ServerSocketChannel;
import tkuri.jxy.arch.TheSelector;
import tkuri.jxy.server.Server;
/**
*
* @author test25cc
*
*/
public class Main {
public static void main(String...args) {
try {
ServerSocketChannel serverSocket = ServerSocketChannel.open();
serverSocket.configureBlocking(false);
serverSocket.socket().bind(new InetSocketAddress(Config.httpPort));
Server server = new Server(serverSocket);
TheSelector.registerChannel(serverSocket, SelectionKey.OP_ACCEPT, server);
while (true) {
Thread.yield();
if (TheSelector.select() > 0) {
TheSelector.dispatchSelecteds();
}
}
} catch (Throwable thrown) {
Util.say(thrown);
}
}
}