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.

10. Networking

Review the presentation Network

Tasks

  1. If necessary, change the value of the variable static final int port = 7700 in the class TttNet.java and the value of port in the src/resources/appplication.properties settings file to another number, e.g. 7701
  2. Explore the jtm.activity10 package
  3. Run the TttCli class in a terminal to see how it works in a terminal using standard input and output:

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

    and enter the cell numbers.

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

      java -cp target/classes/ jtm.activity10.TttNet
    2. Check if the server is listening by running the command in another terminal:

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

      nc 127.0.1.1 7700

      and it should work the same as TttCli, with the only difference
      that the data is sent over a network socket.

  6. When the TttNet class has a client part implemented, in another terminal:

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

    it should work the same as TttCli, except that the data is sent over a network socket.

  7. If necessary, check all running Java processes with the command:

    ps -efaw|grep java
  8. If necessary, you can stop the application with the command:

    kill -9 pid
    where pid is the process ID from the previous command

Additional information (in Latvian)


  

Created by Valdis Vītoliņš on 2025-01-28 17:38
Last modified by Valdis Vītoliņš on 2025-01-28 17:38
 
Xwiki Powered
Creative Commons Attribution 3.0 Unported License