连接到矿池
Connect to mining pool
我正在尝试建立与门罗币矿池的连接。我知道矿池使用的是层协议。但是如果我尝试创建套接字,我唯一收到的是连接超时:
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 只是一个示例。它不适用于任何游泳池。我做错了什么?
尝试使用端口 80。确保您将 INTERNET 权限写入 AndroidManifest 并使用 AsyncTask。
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;
}
}
- 也不要忘记调用 new AsyncExec().execute()。
我正在尝试建立与门罗币矿池的连接。我知道矿池使用的是层协议。但是如果我尝试创建套接字,我唯一收到的是连接超时:
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 只是一个示例。它不适用于任何游泳池。我做错了什么?
尝试使用端口 80。确保您将 INTERNET 权限写入 AndroidManifest 并使用 AsyncTask。
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;
}
}
- 也不要忘记调用 new AsyncExec().execute()。