Socket流千万不要放在try……with……resoures中

Socket try with resoures

try(OutputStream os =  clientSocket.getOutputStream()){
    //此语句会导致关闭Socket连接!
    //调试了2天人快要疯掉了!
    //千万要记住!
}catch(Exception e){}

你可能感兴趣的:(Socket流千万不要放在try……with……resoures中)