Scala equivalent of python echo server/client example?

前端 未结 5 1089
一个人的身影
一个人的身影 2020-12-05 00:33

All the \"server\" example in scala use actors, reactors etc...

Can someone show me how to write a dead simple echo server and client, just like the following python

5条回答
  •  佛祖请我去吃肉
    2020-12-05 01:36

    You can use netty java library. Here is an example usage in Scala:

    https://github.com/mcroydon/scala-echo-server

    Generally you need to use Java Socket API. In this example Java Socket API are used, but the whole server is wrapped in Actor in order to process clients in separate thread and not to block acceptor thread (the same thing you will normally do in Java, but you will use threads directly).

提交回复
热议问题