Introduction to part 3: Network programming with 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 2023-2024 - CC BY-SA 4.0

Do you know how does a web server work?

Do you remember this question from part 2?

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

What happens when you browse the Web?

The answer was:

  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
HEIG-VD - DAI Course 2023-2024 - CC BY-SA 4.0

Do you know how does streaming work?

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

How does streaming work (simplified)?

  1. A web browser connects to a service (YouTube, Twitch, etc.)
  2. The service (a server) sends data to the client continuously
  3. The client displays the data as it comes
  4. If the bandwidth is bad, the client adapts the quality of the stream

To optimize the bandwidth, the server certainly uses UDP instead of TCP as it is more efficient.

UDP is a protocol used in streaming, gaming, VoIP, etc. It is more efficient than TCP but less reliable as you will see in this part.

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

What will you learn?

  • Learn how to use of the UDP protocol to:
    • Send and receive data
    • Broadcast messages to multiple clients
    • Find services on the network with service discovery patterns
  • How to Dockerize a Java application
HEIG-VD - DAI Course 2023-2024 - CC BY-SA 4.0

What will you accomplish?

  • Create a network application using the UDP protocol (with its own application protocol)
  • Build and share your application with Docker and Docker Compose
  • Again, sharing your work on GitHub (it's becoming a habit!)
HEIG-VD - DAI Course 2023-2024 - CC BY-SA 4.0

Sources

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