Note that there are some explanatory texts on larger screens.

plurals
  1. POAkka Actor can't connect to remote server where Scala Actor could
    primarykey
    data
    text
    <p>I got a little problem. I just moved the client-server-communication of my current project from remote Scala Actors to remote Akka Actors.</p> <p>Everything worked fine while testing on my local machine but once I tried to run the code with the client and server at different machines the client can't reach the server anymore (I get a <code>java.nio.channels.NotYetConnectedException</code>). I double and tripple checked the ip and port being used. It's the same host data I used in the code with the Scala actors (which by the way still work. So apparently nothing changed at the firewall settings and server is technically reachable)</p> <p>Here are the important parts of the code (which I mostly copy pasted from akkas homepage):</p> <p>On the server actor</p> <pre><code>import akka.actor.Actor._ import akka.actor.{Actor, ActorRef, Supervisor} override def preStart = { // I also tried the servers external ip here remote.start(host, 1357) // SERVER_SERVICE_NAME is a string constant in a trait that both server // and client extend // all actual work is refered to SessionActor remote.registerPerSession(SERVER_SERVICE_NAME, actorOf[SessionActor]) } </code></pre> <p>and on the client:</p> <pre><code>import akka.actor.Actor._ import akka.actor.{Actor, ActorRef, Supervisor} override def preStart = { // CLIENT_SERVICE_NAME is a string constant Actor.remote.start("localhost", 5678).register(CLIENT_SERVICE_NAME, self) // I also tried "Thread sleep 1000" here just in case // internalServer is a private var of the type Option[ActorRef] // host and serverPort are actually read from a propertiesfile. Guess this // doesn't matter. I checked them. internalServer = Some( remote.actorFor(SERVER_SERVICE_NAME, host, serverPort) ) // Again I tried "Thread sleep 1000" here. Didn't help neither internalServer foreach (server =&gt; { (server !! Ping) foreach (_ match { // !!! this is where the exception is thrown !!! case Pong =&gt; println("connected") case _ =&gt; println("something's fishy") }) }) } </code></pre> <p>I am using: Scala 2.8.1 (although I'm no sure whether the machines at my client are 2.8 or 2.8.1, I use the scala-library.jar from the akka distribution) Akka 1.0</p> <p>I know that you can't debugg my code her but I'd be very thankfull for any kind of hint or idea what might be going wrong here.</p> <p>P.S.: the Exception is thrown within a splitsecond after trying to send the <code>Ping</code>. So I didn't bother increasing the Timeout-time.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload