[英]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.