Hi I am getting a connection reset when using the latest geth. I am working on a laptop with latest windows 10 pro with updates. I and using latest WSL and installed with it ganache and geth. I am using a bit of java code with web3j running on an Android client that has android 10. From my exception thrown "connection reset" it looks like the exception trace starts when the socket is read. When I started up geth I used the dev mode and it looks as if everything was fine. I am using the http interface or --http when starting geth. Below is my geth settings, android client code. Any idea what the issue is?? Since no could not connect was thrown the android could reach my geth node. I did not see any indication in geth the connection occurded but not sure if I should have. I do not know here the log entries for the http geth component can be found on WSL. I spent a bit of time getting as far as I have and would appreciate help for any ethereum expert. Many Many thanks for any help resolving this error/exception.

The arch is:

Android client/phone -> local wireless network -> Wifi adaptor -> proxy -> vEthernet (WSL) adaptor --> geth

Geth startup in WSL (Ubuntu): geth --datadir test-chain-dir --http --dev --verbosity 5

Powershell Portproxy setup:

netsh interface portproxy add v4tov4 listenport=8545 listenaddress= connectport=8545 connectaddress=$($(wsl hostname -I).Trim());

Java code:

void runWeb3jService(){

    Thread thread = new Thread(new Runnable() {

        public void run() {
            try {
                System.out.println("debug EthereumCloudService.runWeb3jService() :1");
                Web3jService web3jService = new HttpService(createOkHttpClient(), false);
                System.out.println("debug EthereumCloudService.runWeb3jService() :2");
                //Web3j web3 = Web3j.build(new HttpService(""));
                web3jService = new HttpService(url, createOkHttpClient(), false);
                Web3j web3 = Web3j.build(web3jService);
                System.out.println("debug EthereumCloudService.runWeb3jService() :3");
                long result=100000;
                try {
                    System.out.println("debug EthereumCloudService.runWeb3jService() :4");
                    //result = web3.ethBlockNumber().send().getBlockNumber().longValue();
                    //boolean listening = web3.netListening().send().isListening();
                    //System.out.println("debug listening:" + listening);
                    //String res1 = web3.netVersion().send().getNetVersion();
                    //System.out.println("debug NetVersion:" + res1);
                    String res2 = web3.web3ClientVersion().send().getWeb3ClientVersion();
                    System.out.println("debug EthereumCloudService.runWeb3jService() :5");
                    //    result = web3.ethBlockNumber().sendAsync().get();
                } catch (Exception ex) {
                    System.out.println("debug EthereumCloudService.runWeb3jService() :6");
                    System.out.println("debug ex: " + ex.toString());
                    //System.out.println("debug EthereumCloudService.runWeb3jService() :7");
                //System.out.println("debug The Last Block Number is: " + result);
            } catch (Exception e) {


Example exception trace on smartphone:

W/System.err: java.net.SocketException: Connection reset
W/System.err:     at java.net.SocketInputStream.read(SocketInputStream.java:215)
W/System.err:     at java.net.SocketInputStream.read(SocketInputStream.java:144)
W/System.err:     at okio.InputStreamSource.read(JvmOkio.kt:94)
  • FYI I am using geth 1.10.17 and since the issue may be protocol related I am using web3j core 4.8.8 since that was the last labeled Android version. Still getting the same issue. My connection timeouts for connect and read is set to 10 seconds. I am using dev mode for geth so not sure how long I have to wait till before I can run a test against it. Commented Apr 28, 2022 at 7:27

1 Answer 1


Ok I figured it out. Get by default is using the wrong ip when you do not specify it in my situation. Always use the ip ubuntu specifies. You can find it simply by executing the ifconfig command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.