我试过写服务器端应用程序.从学校开始,我倾向于不要让代码无限循环.但是,在我的服务器端应用程序中,我还没有找到在什么条件下我应该从无限循环中退出的方式.代码
ServerSocket s = null;
s = new ServerSocket(5000 , 10);
Socket connection = null;
while(true)
{
connection = s.accept();
//create new thread to handle client
new client_handler(connection).start();
}
Run Code Online (Sandbox Code Playgroud) java ×1