[英]server can't receive eof in java
FileOutputStream fos = new FileOutputStream(fileName);
InputStream is = clientSocket.getInputStream();
while ((readBytes = is.read()) != -1)
{
fos.write(readBytes);
System.err.println(readBytes);
}
System.err.println(readBytes);
clientSocket.shutdownOutput();
fos.close();
System.out.println("Trans complete");
客戶端發送-1,但服務器無法接收-1
如何獲得所有文件 ?
關閉FileOutputStream之前,請調用flush()。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.