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=192.164.1.112 connectport=8545 connectaddress=$($(wsl hostname -I).Trim());
Java code:
void runWeb3jService(){
Thread thread = new Thread(new Runnable() {
//@Override
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("http://192.168.1.112:8545/"));
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) {
ex.printStackTrace();
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) {
e.printStackTrace();
}
}
});
thread.start();
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)