libaums
libaums copied to clipboard
NanoHTTPD: Could not send response to the client
Problem
When I start a NanoHttpdServer to play a video, logcat has always output errors below. However, video can play except having some lags sometimes. I think this may influence the playback‘s fluency. I want to know why these errors may occur? Thanks in advance!
Stacktrace of Excpetion
2020-09-01 13:48:22.289 16008-17622/com.github.mjdev.usbfileman D/NanoHttpdServer: Request: /Inside Bill's Brain- Decoding Bill Gates - Official Trailer - Netflix.mp4
2020-09-01 13:48:22.289 16008-17622/com.github.mjdev.usbfileman D/UsbFileHttpServer: Using lru cache for /Inside Bill's Brain- Decoding Bill Gates - Official Trailer - Netflix.mp4
2020-09-01 13:48:22.289 16008-17622/com.github.mjdev.usbfileman D/NanoHttpdServer: Serving range of file bytes=3863517-
2020-09-01 13:48:22.289 16008-17622/com.github.mjdev.usbfileman D/NanoHttpdServer: Serving file from 3863517 to 59605888, Content-Length: 55742372
2020-09-01 13:48:22.289 16008-17618/com.github.mjdev.usbfileman E/fi.iki.elonen.NanoHTTPD: Could not send response to the client
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:112)
at java.net.SocketOutputStream.write(SocketOutputStream.java:157)
at fi.iki.elonen.NanoHTTPD$Response.sendBody(NanoHTTPD.java:1694)
at fi.iki.elonen.NanoHTTPD$Response.sendBodyWithCorrectEncoding(NanoHTTPD.java:1667)
at fi.iki.elonen.NanoHTTPD$Response.sendBodyWithCorrectTransferAndEncoding(NanoHTTPD.java:1657)
at fi.iki.elonen.NanoHTTPD$Response.send(NanoHTTPD.java:1624)
at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:957)
at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)
at java.lang.Thread.run(Thread.java:761)
2020-09-01 13:48:23.381 16008-17632/com.github.mjdev.usbfileman D/NanoHttpdServer: Request: /Inside Bill's Brain- Decoding Bill Gates - Official Trailer - Netflix.mp4
2020-09-01 13:48:23.381 16008-17632/com.github.mjdev.usbfileman D/UsbFileHttpServer: Using lru cache for /Inside Bill's Brain- Decoding Bill Gates - Official Trailer - Netflix.mp4
2020-09-01 13:48:23.382 16008-17632/com.github.mjdev.usbfileman D/NanoHttpdServer: Serving range of file bytes=57263186-
2020-09-01 13:48:23.382 16008-17632/com.github.mjdev.usbfileman D/NanoHttpdServer: Serving file from 57263186 to 59605888, Content-Length: 2342703
2020-09-01 13:48:23.388 16008-17622/com.github.mjdev.usbfileman E/fi.iki.elonen.NanoHTTPD: Could not send response to the client
java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:112)
at java.net.SocketOutputStream.write(SocketOutputStream.java:157)
at fi.iki.elonen.NanoHTTPD$Response.sendBody(NanoHTTPD.java:1694)
at fi.iki.elonen.NanoHTTPD$Response.sendBodyWithCorrectEncoding(NanoHTTPD.java:1667)
at fi.iki.elonen.NanoHTTPD$Response.sendBodyWithCorrectTransferAndEncoding(NanoHTTPD.java:1657)
at fi.iki.elonen.NanoHTTPD$Response.send(NanoHTTPD.java:1624)
at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:957)
at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)
at java.lang.Thread.run(Thread.java:761)
Hey there,
yeah this looks familiar, I remember that I was not able to solve this, that is why I tried the AsyncHttpServer, which works better but not perfect.