Introduction to part 2: Network programming with TCP and UDP

https://github.com/heig-vd-dai-course

Web · PDF

L. Delafontaine and H. Louis, with the help of GitHub Copilot.

This work is licensed under the CC BY-SA 4.0 license.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Do you know what happens when you browse the Web? How do you think it works?

Do you remember this question from part 1?

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

The answer was:

What happens when you browse the Web

  1. You request a resource (e.g. a file) from a web server
  2. The web server opens the file
  3. The web server reads the file
  4. The web server sends the file to you
  5. Your web browser receives the file
  6. Your web browser displays the file

The whole process uses input/output (IO) operations!

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Do you know how does a web server work? How do you think it works?

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

How does a web server work

  1. A process is started on the server
  2. This process opens a socket on a specific port
  3. The process waits for a connection
  4. A client (another process) connects to the server
  5. The server and the client exchange data
  6. The client or server closes the connection

The server and the client communicate over the network using a network protocol, exchanging data the same way as IOs operations.

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

What will you learn?

  • What is an application protocol
  • What is the TCP protocol
  • What is the UDP protocol
  • Learn the differences between TCP and UDP
  • Manage multiple connections with Java network concurrency
  • Learn about the electronic messaging protocols
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

What will you accomplish?

  • Define and implement a game called "Guess the number" with TCP
  • Define and implement an application called "Temperature monitoring" with UDP
  • Define, implement and share your own a network application
HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0

Sources

HEIG-VD - DAI Course 2024-2025 - CC BY-SA 4.0