title: fi.iki.elonen.NanoHTTPD: Could not send response to the client,java.net.SocketException: sendto failed: ECONNRESET (Connection reset by peer) #444
body: <p>i am using NanoHttpd to serve the videos in my android application but i am getting the below error please help me.</p>
  
  <pre><code>    fi.iki.elonen.NanoHTTPD: Could not send response to the client
  java.net.SocketException: sendto failed: ECONNRESET (Connection reset by peer)
  at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:546)
  at libcore.io.IoBridge.sendto(IoBridge.java:515)
  at java.net.PlainSocketImpl.write(PlainSocketImpl.java:504)
  at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:37)
  at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:266)
  at fi.iki.elonen.NanoHTTPD$Response$ChunkedOutputStream.write(NanoHTTPD.java:1369)
  at fi.iki.elonen.NanoHTTPD$Response.sendBody(NanoHTTPD.java:1620)
  at fi.iki.elonen.NanoHTTPD$Response.sendBodyWithCorrectEncoding(NanoHTTPD.java:1593)
  at fi.iki.elonen.NanoHTTPD$Response.sendBodyWithCorrectTransferAndEncoding(NanoHTTPD.java:1580)
  at fi.iki.elonen.NanoHTTPD$Response.send(NanoHTTPD.java:1550)
  at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:937)
  at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)
  at java.lang.Thread.run(Thread.java:818)
  Caused by: android.system.ErrnoException: sendto failed: ECONNRESET (Connection reset by peer)
  at libcore.io.Posix.sendtoBytes(Native Method)
  at libcore.io.Posix.sendto(Posix.java:206)
  at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:278)
  at libcore.io.IoBridge.sendto(IoBridge.java:513)
  at java.net.PlainSocketImpl.write(PlainSocketImpl.java:504) 
  at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:37) 
  at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:266)at fi.iki.elonen.NanoHTTPD$Response$ChunkedOutputStream.write(NanoHTTPD.java:1369) 
  at fi.iki.elonen.NanoHTTPD$Response.sendBody(NanoHTTPD.java:1620) 
  at fi.iki.elonen.NanoHTTPD$Response.sendBodyWithCorrectEncoding(NanoHTTPD.java:1593) 
  at fi.iki.elonen.NanoHTTPD$Response.sendBodyWithCorrectTransferAndEncoding(NanoHTTPD.java:1580) 
  at fi.iki.elonen.NanoHTTPD$Response.send(NanoHTTPD.java:1550) 
  at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:937) 
  at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192) 
  at java.lang.Thread.run(Thread.java:818)
  </code></pre>
  
  <p>Some Suggestions says to add below code to solve the issue and i added as well but no results
  if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThreadPolicy(policy); } 
   Please help me.
  Thanks </p>