简体   繁体   English

Java中的httpServer中的管道中断

[英]Broken Pipe in httpServer in java

I made an httpServer in java in order to send files to a client. 我用Java制作了一个httpServer,以便将文件发送到客户端。 The problem is that after I send the file I've been asked for me server keeps getting null commands in buffereader and throws broken Pipe exception. 问题是,在我发送文件后,我一直被问到服务器,服务器不断在buffereader中获取空命令,并抛出损坏的Pipe异常。 Is there a way to avoid getting null commands?? 有没有办法避免得到空命令?

没有诸如“ BufferedReader的空命令”之类的东西,而是诸如BufferedReader.readLine()返回null之类的东西,这意味着对等方已关闭连接,您也应该这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM