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-server
project to IDE. - Run
Main.scala
.
-
Client
- Refresh & build project to install required dependencies.
- Import
<project-dir>/scala/tcp-client
project to IDE. - Run
Main.scala
.
-
Server
- Move to
<project-dir>/scala/tcp-server
and enter intosbt
console -
$ cd <project-dir>/scala/tcp-server $ sbt >
- Install plugins and dependencies under
sbt
console -
> reload > update
- Run server as -
> run
- Move to
-
Client
- Move to
<project-dir>/scala/tcp-client
and enter intosbt
console -
$ cd <project-dir>/scala/tcp-client $ sbt >
- Install plugins and dependencies under
sbt
console -
> reload > update
- Run server as -
> run
- Move to
Note: Default host is
0.0.0.0
and port is9900
. This configuration can be changed.
- Python3
Note:
server.py
creates 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.0
and port is9900
. This configuration can be changed.
- node
- npm
-
Server Run server as -
node tcp-server.js
Note: Default host is
0.0.0.0
and port is5000
. This configuration can be changed.