java.io.IOException: unexpected end of stream on Connection in android

后端 未结 10 1028
你的背包
你的背包 2020-12-01 12:40

I have web service URL, it working fine. It gives the JSON data.

When I am using HttpURLConnection and InputStream, I am getting this erro

相关标签:
10条回答
  • 2020-12-01 13:25

    Most probably there are 2 things, happening at the same time.
    First, the url contains a port which is not commonly used AND secondly, you are using a VPN or proxy that does not support that port.
    Personally, I had the same problem. My server port was 45860 and I was using pSiphon anti-filter VPN.
    In that condition my Postman reported "connection hang-up" only when server's relpy was an error with status codes bigger than 0. (it was fine when some text was returning from server with no error code)
    Then I changed my web service port to 8080 on my server and, WOW, it worked! although psiphon vpn was connected.
    Therefore, my suggestion is, if you can change the server port, so try it, or check if there is a proxy problem

    0 讨论(0)
  • 2020-12-01 13:27

    I have the same issue. This error is caused by the server-side only supports http2. You need to update JDK to a version that supports http2 (>=jdk9) to fix this issue.

    0 讨论(0)
  • 2020-12-01 13:30

    This may be an old thread, as for me, check your internet connection (Wifi) there might be some restriction on accessing some of your endpoints.

    I've fixed mine by using/connecting to my mobile data.

    -cheers/happy codings

    0 讨论(0)
  • 2020-12-01 13:32

    I was testing my App with localhost using XAMPP and this error was occurring, The problem was with the port i was using skype using 443 port i simply quit skype and error was resolved!

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