Mercurial > hg > Members > tatsuki > Alice
view src/alice/daemon/AcceptThread.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 | 45e98e74db96 |
children | 72dd27d952b0 |
line wrap: on
line source
package alice.daemon; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import org.apache.log4j.Level; import org.apache.log4j.Logger; import alice.datasegment.DataSegment; public class AcceptThread extends Thread { private ServerSocket ss; private Logger log = Logger.getLogger(AcceptThread.class); public AcceptThread(ServerSocket ss, String name) { super(name); this.ss = ss; } @Override public void run() { while (true) { try { Socket socket = ss.accept(); log.info("Accept " + socket.getInetAddress().getHostName() + ":" + socket.getPort()); Connection connection = new Connection(socket); new IncomingTcpConnection(connection, DataSegment.get("local")).start(); new OutboundTcpConnection(connection).start(); } catch (IOException e) { e.printStackTrace(); } } } }