西安邮电大学《分布式计算原理及应用》实验报(3)

发布时间:2021-06-05

// shutdown command

private static final String SHUTDOWN_COMMAND = "/SHUTDOWN";

// the shutdown command received

private boolean shutdown = false;

public static void main(String[] args) {

HttpServer server = new HttpServer();

server.await();

}

public void await() {

ServerSocket serverSocket = null;

int port = 8091;

try {

serverSocket = new ServerSocket(port, 1,

InetAddress.getByName("127.0.0.1"));

}

catch (IOException e) {

e.printStackTrace();

System.exit(1);

}

// Loop waiting for a request

while (!shutdown) {

精彩图片

热门精选

大家正在看