Updated on 2026-08-14

This commit is contained in:
Tangem 2018-10-11 22:50:31 +03:00
parent 4d5cc7255b
commit 439f4f927a
4 changed files with 16 additions and 15 deletions

View file

@ -28,13 +28,12 @@ import io.reactivex.observers.DefaultObserver;
import io.reactivex.schedulers.Schedulers;
public class ServerApiHelperElectrum {
// private static String TAG = ServerApiHelper.class.getSimpleName();
// private static String TAG = ServerApiHelper.class.getSimpleName();
private static String TAG = ServerApiHelperElectrum.class.getSimpleName();
/**
* TCP
* Used in BTC
* https://sidstudio.com.ua/sidstudio-blog/%D0%BF%D0%B5%D1%80%D0%B5%D0%B4%D0%B0%D1%87%D0%B0-%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D1%85-%D0%BF%D0%BE-%D1%81%D0%B5%D1%82%D0%B8-%D0%BF%D1%80%D0%B8-%D0%BF%D0%BE%D0%BC%D0%BE%D1%89%D0%B8-socket-%D0%BF%D1%80%D0%B8-%D1%80%D0%B0%D0%B7%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%BA%D0%B5-android-%D0%BF%D1%80%D0%B8%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F
*/
private String host;
private int port;
@ -65,7 +64,7 @@ public class ServerApiHelperElectrum {
.retryWhen(errors -> errors
.filter(throwable -> throwable instanceof NullPointerException)
.zipWith(Observable.range(1, 2), (n, i) -> i))
.zipWith(Observable.range(1, 4), (n, i) -> i))
.subscribeOn(Schedulers.io())
@ -112,13 +111,15 @@ public class ServerApiHelperElectrum {
Collections.addAll(result, electrumRequest);
try {
// Socket socket = App.getComponent().getSocket();
Socket socket = App.getComponent().getSocket();
Socket socket = new Socket();
socket.setSoTimeout(5000);
socket.bind(new InetSocketAddress(0));
// Socket socket = new Socket();
// socket.setSoTimeout(5000);
// socket.bind(new InetSocketAddress(0));
Log.i(TAG, host + " " + port);
socket.connect(new InetSocketAddress(InetAddress.getByName(host), port));
try {
OutputStream os = socket.getOutputStream();