java.net.Socketexception: Connection reset

Asked

Viewed 756 times

-1

I have a web service that validates the users of the application that runs on Android. In positive case the system returns a JSON with the information that is ok and to which database that user has access.

Step one simple JSON to the service:

{ 
    "email":"[email protected]",
    "senha":"12456"
}

It is happening that when calling the service through the WIFI works as expected, but if I call through 4G I get the following error message:

java.net.SocketException: Connection reset

Looking at the service log check that the request even reaches the server.

Someone’s been there and can help me?

  • It shows no effort. I’m researching since 8:30 am. Only then I had the idea to ask you. Tsc.....

  • In fact I have already found the solution and could have deleted the question, but I thought it could be useful for someone else, after all it is a boring problem and without an apparent solution. But what does the community do? Negative the question. It’s a shame.

1 answer

0

You’ve added internet access to your app?

Permissions:

< uses-permission android:name="android.permission.INTERNET"/ >

< uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/ >

< uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/ >

These permissions should be placed in the Androidmanifest.xml class

  • Yes. As I said with the WIFI access normally.

  • see this: https://stackoverflow.com/questions/43406275/getting-error-java-net-socketexception-connection-reset

  • Thanks João for the attention. I had already seen this link, but neither is that. The code on Webservice also has no problems. For two reasons: with WIFI works perfectly and with 4G it even arrives on the server. However I know it is the server that this resetting because if I leave the service stopped gives TIMEOUT error and if I run the service it does not accept connections through 4G.

  • I have a code that uses Json. I’ll make it available for you to download and compare. https://drive.google.com/open?id=1kheVh9bjc4oJ0NcJyyEp6h59CzDCEOwn

  • 1

    I don’t know, but it looks like infrastructure. Isn’t there some restriction in the Server Firewall, or some blockage in the anti-virus and so on? You logged into Webservice, right?! You would have to monitor the Server with Wireshark to see if the request is coming and where it is being sent through the Firewall. I’ve had problems with socket connections and that was the problem.

  • Thanks @Raquelpinheiro. I downloaded the program Wireshark, I will monitor to see what comes and if comes.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.