javaandroidsocketsstratum

Connect to mining pool


I am trying to etablish a connection to a monero mining pool. I know that the mining pools using the stratum protocol. But the only thing I receive is a connection timeout if I try to create a socket:

try{
    InetAddress address = InetAddress.getByName("pool.supportxmr.com");
    Log.d("miner","Attempting to connect to " + address.toString() + " on port " + port + ".");

    Socket  socket = new Socket(address, 3333);
    Log.d("miner", "Connection success");
}catch (IOException e){
    e.printStackTrace();
}

SupportXmr is just an example. Its not working with any pool. What am I doing wrong?


Solution

  • Try with port 80. Make sure you wrote INTERNET permission to AndroidManifest and use AsnycTask.

    private class AsyncExec extends AsyncTask<Void,Void,Void>{
    
    
        @Override
        protected Void doInBackground(Void... voids) {
            int port=80;
            try
            {
                InetAddress address = InetAddress.getByName("pool.supportxmr.com");
                Log.d("miner","Attempting to connect to " + address.toString() + " on port " + port + ".");
    
                Socket socket = new Socket(address, 3333);
                Log.d("miner", "Connection success");
            }
            catch (IOException e)
            {
                e.printStackTrace();
    
            }
            return null;
        }
    }