Package tkuri.jxy

Source Code of tkuri.jxy.Main

/**
* (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);
    }
  }
}



TOP

Related Classes of tkuri.jxy.Main

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.