Slide 1

Slide 1 text

Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info o ffi ce: 14 -227 CSC 508/9 Software Engineering (Design & Deployment) Lecture 09. Distributed Computing

Slide 2

Slide 2 text

Distributed System Architecture

Slide 3

Slide 3 text

Architecture 3

Slide 4

Slide 4 text

Communication Protocols Sockets • - Wh a t: Low-level communic a tion mech a nism for exch a nging d a t a between two systems. • - How: Utilizes TCP/UDP protocols for reli a ble/unreli a ble d a t a tr a nsfer. • - Use C a se: Direct communic a tion between client-server a pplic a tions (e.g., f ile tr a nsfer a nd ch a t). WebSockets • - Wh a t: Full-duplex communic a tion protocol over a single TCP connection. • - How: En a bles persistent, bidirection a l communic a tion between client a nd server in re a l- time. • - Use C a se: Re a l-time a pplic a tions like live ch a ts, g a ming, a nd stock tr a ding pl a tforms. MQTT (Mess a ge Queuing Telemetry Tr a nsport) • Wh a t: Lightweight mess a ging protocol designed for low-b a ndwidth, high-l a tency networks. • How: Uses a publish-subscribe p a ttern for e ff icient communic a tion between devices. • Use C a se: Ide a l for IoT a pplic a tions, sm a rt home devices, a nd sensor networks. 4

Slide 5

Slide 5 text

Client-Server Sockets

Slide 6

Slide 6 text

Client-Server 6

Slide 7

Slide 7 text

Implementation :: Server 7 chrestomathy: https://www.javatpoint.com/socket-programming

Slide 8

Slide 8 text

Implementation :: Client 8 chrestomathy: https://www.javatpoint.com/socket-programming

Slide 9

Slide 9 text

Client-Server WebSockets

Slide 10

Slide 10 text

Reference 10 https://shorturl.at/YHiBY

Slide 11

Slide 11 text

Publisher-Subscriber MQTT

Slide 12

Slide 12 text

Message Queuing 12

Slide 13

Slide 13 text

Eclipse Paho for Java Wh a t is Eclipse P a ho? • A set of MQTT client libr a ries developed by the Eclipse Found a tion. • It supports multiple l a ngu a ges, such a s J a v a , Python, J a v a Script, etc. J a v a Dependency (M a ven) org.eclipse.paho org.eclipse.paho.client.mqttv3 1.2.5 13

Slide 14

Slide 14 text

https://github.com/CSC3100/MQTT

Slide 15

Slide 15 text

Quality-of-service options • 0 – "at most once": A.K.A. "fire-and-forget." This option is suitable when message loss is acceptable, as it doesn't require acknowledgment or persistence. • 1 – "at least once": This option should be chosen when message loss is unacceptable, and your subscribers can handle duplicate messages. • 2 – "Exactly once": This option is ideal when message loss is unacceptable, and your subscribers cannot handle duplicate messages. 15

Slide 16

Slide 16 text

https://github.com/CSC3100/MQTT

Slide 17

Slide 17 text

Pong 17 https://github.com/CSC3100/Pong-Game

Slide 18

Slide 18 text

Questions 18

Slide 19

Slide 19 text

CSC 509 Software Engineering Javier Gonzalez-Sanchez, Ph.D. [email protected] Fall 2025 Copyright. These slides can only be used as study material for the class CSC509 at Cal Poly. They cannot be distributed or used for another purpose.