title: Getting "SocketException : Connection reset by peer" in Android
body: <p>My app needs to contact the same device it is working on, via <code>http://127.0.0.1/...</code> (a localhost url).</p>
  
  <p>For some reason, about 50% of the times (and maybe exactly 50%) when I reach a website there with JSON content, I get the exception:</p>
  
  <blockquote>
    <p>java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer) </p>
  </blockquote>
  
  <p>For the other 50%, I get perfectly good results. I've tried to do polls (and even large delay between polls), but I keep getting the same weird results.</p>
  
  <p>I've searched the internet and also here, and I'm not sure why it occurs. Does the peer mean that the client has caused it? Why does it happen, and how should i handle it?</p>
  
  <p>Some websites say that it's a common thing, but I didn't find what's the best thing to do in such cases.</p>