Dear Björn,
you were perfectly right. It seems that the problem was selfmade. Thank you 
very much for your time. Problem solved :-)

On Thursday, April 3, 2014 9:59:39 AM UTC+2, Chris Vaas wrote:
>
> The following code is a basic TCP server and client, that should 
> communicate. But the log is as shown below the source code. No data is ever 
> received by the connection handler, after several connections got handled 
> correctly. What am I missing here?
>
> package examples
> import akka.io.Tcpimport akka.actor.Actorimport akka.io.Tcp.Boundimport 
> akka.io.Tcp.CommandFailedimport akka.io.IOimport akka.io.Tcp.Connectedimport 
> org.slf4j.LoggerFactoryimport akka.actor.Propsimport 
> utils.ConfigurationUtilsimport java.net.InetSocketAddressimport 
> akka.actor.Stashimport akka.actor.ActorSystemimport akka.util.ByteString
> object TCP_Debug extends App {
>   val name = this.getClass().getName()
>   val logger = LoggerFactory.getLogger(name)
>
>   logger.info("Starting server and flooder")
>   val system = ActorSystem("Midas")
>   val sever = system.actorOf(Props[Server], "Server")
>   val flooder = system.actorOf(Props[AlarmFlooder], "Flooder")
>
>   for (i <- 1 to 10) {
>     Thread.sleep(1000)
>     flooder ! Msg("Message " + i)
>   }}
> class Server extends Actor {
>   import Tcp._
>   import context._
>
>   val name = this.getClass.getName
>   val logger = LoggerFactory.getLogger(name)
>
>   IO(Tcp) ! Bind(self, new InetSocketAddress("0.0.0.0", 4444))
>
>   def receive = {
>     case Bound(localAddress) =>
>       logger.info("Bound to {}:{}", localAddress.getAddress, 
> localAddress.getPort)
>     case CommandFailed(Bind(_, localAddress: InetSocketAddress, _, _, _)) =>
>       logger.info("Could not bind to {}:{}", localAddress.getHostName, 
> localAddress.getPort)
>       context stop self
>     case c @ Connected(remote, local) =>
>       val connection = sender()
>       val handler = context.actorOf(Props[ConnectionHandler])
>       connection ! Register(handler)
>       logger.info("Client connected from {}:{}", remote.getHostName, 
> remote.getPort)
>     case a @ _ => logger.info("Unknown message: " + a.toString)
>   }}
> private class ConnectionHandler extends Actor {
>   import Tcp._
>   import scala.xml._
>
>   val name = this.getClass.getName
>   val logger = LoggerFactory.getLogger(name)
>
>   def receive = {
>     case Received(data) => {
>       logger.info("Received {} bytes of data", data.length)
>     }
>     case PeerClosed =>
>       logger.info("Connection closed")
>       context stop self
>     case a @ _ => logger.info("Unknown message: " + a.toString)
>   }}
> case class Msg(content: String)
> class AlarmFlooder <s
>
> ...

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to