TCP Client & Server in Scala, Python3, Node.js
- JDK 1.8.x
- Scala 2.12.x (defined under
../build.sbt) - sbt 1.1.x (defined under
..project/build.properties)
Project can be run either by using an IDE(eclipse, IntelliJ) or via sbt console.
-
Server
- Refresh & build project to install required dependencies.
- Import
<project-dir>/scala/tcp-serverproject to IDE. - Run
Main.scala.
-
Client
- Refresh & build project to install required dependencies.
- Import
<project-dir>/scala/tcp-clientproject to IDE. - Run
Main.scala.
-
Server
- Move to
<project-dir>/scala/tcp-serverand enter intosbtconsole -
$ cd <project-dir>/scala/tcp-server $ sbt >
- Install plugins and dependencies under
sbtconsole -
> reload > update
- Run server as -
> run - Move to
-
Client
- Move to
<project-dir>/scala/tcp-clientand enter intosbtconsole -
$ cd <project-dir>/scala/tcp-client $ sbt >
- Install plugins and dependencies under
sbtconsole -
> reload > update
- Run server as -
> run - Move to
Note: Default host is
0.0.0.0and port is9900. This configuration can be changed.
- Python3
Note:
server.pycreates single threaded server and can handle single connection at a time. Although it can be easily be extended to support multiple connections.
-
Server Run server as -
$ python3 <project-dir>/python3/server.py
-
Client Run client as -
$ python3 <project-dir>/python3/client.py
Note: Default host is
0.0.0.0and port is9900. This configuration can be changed.
- node
- npm
-
Server Run server as -
node tcp-server.js
Note: Default host is
0.0.0.0and port is5000. This configuration can be changed.