Skip to content
Snippets Groups Projects
Unverified Commit 961b2e54 authored by Freeeed's avatar Freeeed
Browse files

Fixed hostname config for remote

parent c6edc0f9
Branches
No related tags found
1 merge request!3Preliminary result of the software
package fucoin; package fucoin;
import java.io.File;
import java.util.concurrent.TimeUnit;
import akka.actor.ActorRef; import akka.actor.ActorRef;
import akka.actor.ActorSelection; import akka.actor.ActorSelection;
import akka.actor.ActorSystem; import akka.actor.ActorSystem;
import akka.util.Timeout; import akka.util.Timeout;
import com.typesafe.config.Config; import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory; import com.typesafe.config.ConfigFactory;
...@@ -14,6 +10,10 @@ import fucoin.wallet.WalletImpl; ...@@ -14,6 +10,10 @@ import fucoin.wallet.WalletImpl;
import scala.concurrent.Await; import scala.concurrent.Await;
import javax.swing.*; import javax.swing.*;
import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.concurrent.TimeUnit;
public class MainRemote { public class MainRemote {
...@@ -22,6 +22,14 @@ public class MainRemote { ...@@ -22,6 +22,14 @@ public class MainRemote {
public static void main(String[] args) throws InterruptedException { public static void main(String[] args) throws InterruptedException {
String hostname = "127.0.0.1";
try {
// Fetch IP address to enable network connection
hostname = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
}
//Load configuration from current directory or from resources directory of jar //Load configuration from current directory or from resources directory of jar
File file = new File("application.conf"); File file = new File("application.conf");
Config config = ConfigFactory.parseFile(file); Config config = ConfigFactory.parseFile(file);
...@@ -33,7 +41,7 @@ public class MainRemote { ...@@ -33,7 +41,7 @@ public class MainRemote {
} }
//Init System Actor System //Init System Actor System
ActorSystem system = ActorSystem.create("Remote", config); ActorSystem system = ActorSystem.create("Remote", ConfigFactory.parseString("akka.remote.netty.tcp.hostname=" + hostname).withFallback(config));
JPanel dialogPanel = createDialogPanel(); JPanel dialogPanel = createDialogPanel();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment