Created
March 28, 2018 09:23
-
-
Save josemmo/7d982a32c4a96b529572c1557c3f947b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void connectToServer(InetAddress ip) { | |
try { | |
Socket s = new Socket(); | |
s.connect( | |
new InetSocketAddress(ip, Cutrecoin.PORT), | |
Cutrecoin.TIMEOUT | |
); | |
s.close(); | |
// Añadir a la lista de nodos | |
for (InetAddress ia : peers) { | |
if (ia.equals(ip)) return; | |
} | |
peers.add(ip); | |
} catch (Exception e) { | |
peers.remove(ip); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment