Ginsan Ginsan - 18 days ago 8
Scala Question

Akka Port Forwarding

I am trying to perform port forwarding towards my Akka program where the client can communicate with the server over the Internet. I have configured my router and the port forwarding mechanism is working but there seems to be a problem with Akka.

The problem is that the client is unable to obtain the remote actor from the server. It keep coming out error at the server side that the recipient are different. The client is obtaining the remote actor through

"akka.tcp://RemoteSystem@67.18.67.18:5150/user/remote"
where
67.18.67.18
is my global IP address for example. Then the remote actor is remoting at the path
"akka.tcp://RemoteSystem@192.168.0.106:5150/user/remote"
where
192.168.0.106
is my local IP of the server. I know that the client must access the remote actor using the same path but despite I defined the
public-localname
, the server still doesn't translate the global IP to the local IP or allow access through the global IP. Is there any workaround to it? Below is the
application.conf
of the server.

akka {
loglevel = "INFO"

actor {
provider = "akka.remote.RemoteActorRefProvider"
}

remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = ""
port = 5150
public-hostname = "67.18.67.18"
}

log-sent-messages = on
log-received-messages = on
}

}

Answer

The config parameter is "bind-hostname" for the interface you want to bind to, and "hostname" for the public IP. You also need to set "bind-port" for the local port to bind to, and "port" for the public IP.

Consult the documentation for more details: http://doc.akka.io/docs/akka/snapshot/scala/remoting.html

Comments