日期:2014-05-20 浏览次数:20671 次
bool portTaken = false; ServerSocket socket = null; try { serverSocket = new ServerSocket(portNumber); } catch (IOException e) { portTaken = true; } finally { // Clean up if (socket != null) socket.close(); }
------解决方案--------------------
我想也是