62,614
社区成员
发帖
与我相关
我的任务
分享
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();
}
}
}