Mercurial > hg > Database > Alice
view src/alice/daemon/AliceDaemon.java @ 16:433e601a8e28
network bug fix
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 15 Jan 2012 12:17:30 +0900 |
parents | e3f1b21718b0 |
children | 2ca2d961a8d2 |
line wrap: on
line source
package alice.daemon; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.nio.channels.ServerSocketChannel; public class AliceDaemon { private Config conf; private AcceptThread acceptThread; public AliceDaemon(Config conf) { this.conf = conf; } public void listen() { try { ServerSocketChannel ssChannel = ServerSocketChannel.open(); ServerSocket ss = ssChannel.socket(); ss.setReuseAddress(true); ss.bind(new InetSocketAddress(InetAddress.getLocalHost(), conf.port)); acceptThread = new AcceptThread(ss, "ACCEPT" + conf.port); acceptThread.start(); } catch (IOException e) { e.printStackTrace(); } } }