This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center
                            
                        
                    
                
                7年前关闭。
            
        

我正在尝试制作一个多人游戏,其中在具有多个客户端的服务器上进行了许多计算。在计算游戏的同时,我如何让服务器监听新客户。我尝试过的所有操作都会在运行ServerSocket.accept()时暂停整个程序。有没有办法解决?提前致谢。

最佳答案

游戏循环或ServerSocket.accept()都应在自己的Thread中处理,而其他循环应在主线程中运行。

关于java - Java,如何在ServerSocket.accept()接收客户端的同时继续运行? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14301028/

10-11 04:03
查看更多