日期:2014-05-20 浏览次数:20830 次
public class ThreadPre { public static void main(String[] args) throws IOException { ServerSocket socket = new ServerSocket(80); while(true){ final Socket connection = socket.accept(); Runnable task = new Runnable() { @Override public void run() { handle(connection); } }; new Thread(task).start(); } } }