If it is not explicitly told in following recipe, setting up services are described for Ubuntu 20.04 server, but applications are described for Xubuntu 20.04 workstation. If you use different Ubuntu version or Linux distribution, settings as well as content, names and places of configuration files may be different!
Got it.

11. Networking

  1. Review presentation Networking

    Practical exercise

  2. 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
  3. Investigate jtm.activity11 package
  4. Run TttCli class in terminal, to see, how it works in terminal using standard input and output:

    java -cp target/classes/ jtm.activity11.TttCli

    and enter numbers of the cells.

  5. Implement TttNet class to run it either as a server (if port is available), or client (if server is listening to the port)
  6. When running as server is implemented:
    1. Run TttNet in one terminal:

      java -cp target/classes/ jtm.activity11.TttNet
    2. Check if server is listening, by runinng command in other terminal:

      ss -ntlp|grep 7700
    3. Check, how server part works with nc program as a client in other terminal:

      nc 7700

      and it should run in the same way as TttCli, with only difference,
      that data are sent through the network socket.

  7. When client part is implemented for TttNet class, it in another terminal:

    java -cp target/classes/ jtm.activity11.TttNet

    it should work in the same way as TttCli, with only difference,
    that data are sent through the network socket.

  8. If necessary, check all Java processes runnig by command:

    ps -efaw|grep java
  9. If necessary, application can be killed with command:

    kill -9 pid
    wher pid is process id from the previous command

Extra exercises

Additional info (in Latvian)


Created by Valdis Vītoliņš on 2017-01-03 08:07
Last modified by Valdis Vītoliņš on 2024-07-03 22:03
Xwiki Powered
Creative Commons Attribution 3.0 Unported License