我的要求是記錄用戶的聲音並將其保存在服務器上(同時有多個用戶)。代碼是:什麼原因導致SocketTimeoutException
in = (InputStream) request.getInputStream();
fos = new FileOutputStream(f1);
int read = 0;
while ((read = in.read()) != -1) {
fos.write(read);
}
fos.close();
in.close();
我試圖一次爲多個用戶錄製聲音時出現以下異常。這不會給我一個用戶的例外。
java.net.SocketTimeoutException 在org.apache.coyote.http11.InternalAprInputBuffer.fill(InternalAprInputBuffer.java:796) 在org.apache.coyote.http11.InternalAprInputBuffer $ SocketInputBuffer.doRead(InternalAprInputBuffer.java:830 ) 在org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:116) 在org.apache.coyote.http11.InternalAprInputBuffer.doRead(InternalAprInputBuffer.java:738) 在org.apache.coyote .Request.doRead(Request.java:427) at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:304) at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java :386) at org.apache.catalina.connector.InputBuffer.readByte(InputBuffer.java:317) at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:105) at CommonPackage.Upload.processRequest(Upload。的java:78) 在CommonPackage.Upload.doPost(Upload.java:115) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:710) 在javax.servlet.http.HttpServlet.service(的HttpServlet。的java:803) 在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 在org.apache。 catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.cor eStandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 102) 在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 在org.apache.coyote。 http11.Http11AprProcessor.process(Http11AprProcessor.java:877) at org.apache.coyote.http11.Http11AprProtocol $ Http11ConnectionHandler.process(Http11AprProtocol.java:594) at org.apache.tomcat.util.net.AprEndpoint $ Worker。運行(AprEndpoint.java:1675) at java.lang.Thread.run(Thread.java:619)
謝謝