What can be a cause of java.net.SocketException: recvfrom failed: ETIMEDOUT?

后端 未结 2 1236
北海茫月
北海茫月 2020-12-17 21:57

I have got this issue in my app. It is rare and difficult to spot. This is a stack:

2012-11-30 08:42:22.745myapp.package.MyCommand is failed.java.net.SocketE         


        
相关标签:
2条回答
  • 2020-12-17 22:09

    For me this error happened when:

    • the party which is supposed to reply closes the connection unexpectedly.

    My situation: Android connecting to microprocessor via plain socket on port 8080. The problem was the uC would close the connection before actually sending the "OK" reply. Sending is apparently a deferred operation in this uC (ESP8266). The solution was to comment out the line closing the connection (This line of code was there from a previous version in which no reply was intended). Rgds.

    0 讨论(0)
  • 2020-12-17 22:12

    When receiving a "Connection Timeout" error, I would look for:

    • Heavy loaded network connection
    • Heavy loaded server
    • Inadequate connection timeout parameters for the session
    • In Ice Cream Sandwich and earlier check if related to DNS double caching. See DNS caching in InetAddress and Issue 7904: Android does not support TTL and caches DNS result for 10 minutes

    Regards.

    0 讨论(0)
提交回复
热议问题