11. Networking
Main steps
- If necessary, change value of static final int port = 7700 variable in TttNet.java class and value of port key in src/resources/appplication.properties configuration file to different number e.g. 7701
- Investigate jtm.activity11 package
Run TttCli class in terminal, to see, how it works in terminal using standard input and output:
java -cp target/classes/ jtm.activity11.TttCliand enter numbers of the cells.
- Implement TttNet class to run it either as a server (if port is available), or client (if server is listening to the port)
- When running as server is implemented:
Run TttNet in one terminal:
java -cp target/classes/ jtm.activity11.TttNetCheck if server is listening, by runinng command in other terminal:
ss -ntlp|grep 7700Check, how server part works with nc program as a client in other terminal:
nc 127.0.1.1 7700and it should run in the same way as TttCli, with only difference,
that data are sent through the network socket.
When client part is implemented for TttNet class, it in another terminal:
java -cp target/classes/ jtm.activity11.TttNetit should work in the same way as TttCli, with only difference,
that data are sent through the network socket.If necessary, check all Java processes runnig by command:
ps -efaw|grep java- wher pid is process id from the previous command
If necessary, application can be killed with command:
kill -9 pid