Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSC364 Lecture 04

CSC364 Lecture 04

Introduction to Networked, Distributed, and Parallel Computing
Handling Protocols
(202601)

Avatar for Javier Gonzalez-Sanchez

Javier Gonzalez-Sanchez PRO

January 13, 2026
Tweet

Transcript

  1. Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info o ffi ce: 14 -227

    CSC 364 Introduction to Networked, Distributed, and Parallel Computing Lecture 04. Handling Protocols 1
  2. 15 Idea Your Computer Port Port Port Port Port Port

    Port Port Socket Socket example.org
  3. 17

  4. 18

  5. 19 What this code is really doing Even though it

    looks like just sockets, it is a ctu a lly a ssuming th a t the server spe a ks HTTP • HTTP uses CRLF (\r\n) • HTTP/1.1 requires a Host he a der • The expect a GET • The server decides when to close the connection 👉 Sockets don’t know a ny of this. 👉 The protocol does. ➡ Sockets a nswer how bytes move. ➡ Protocols a nswer wh a t those bytes me a n ➡ Every time we t a lk to a di ff erent server, we must follow their rules
  6. 21 Encapsulation •Socket cre a tion •Request form a tting

    (He a ders) •St a tus codes •Connection lifecycle •Encoding
  7. 23 Encapsulation From this: Socket socket = new Socket(host, 80);

    out.write("GET / HTTP/1.1\r\nHost: ...".getBytes()); To this: URL url = new URL("http://example.com"); HttpURLConnection con =(HttpURLConnection) url.openConnection(); ➡ Good softw a re hides protocol complexity behind objects
  8. 30 What about this Cal Poly Secure Web Page: Port

    443 https://www.calpoly.edu ➡ Good softw a re hides protocol complexity behind objects Cal Poly Web Page: Port 80 http://www.calpoly.edu
  9. 31 Lab ➡ Use a socket to connect to www.c

    a lpoly.edu using port 80 (HTTP pl a in text) ➡ Use a socket to connect to www.c a lpoly.edu using port 443 (HTTP over encryption) ➡ Use a n HttpConnection to connect to www.c a lpoly.edu (no port needed) ➡ Use a socket to connect to www.j a viergs.com using port 80 (HTTP pl a in text) ➡ Use a n HttpConnection to connect to www.j a viergs.com (no port needed ✏ Expl a in your results
  10. CSC 364 Introduction to Introduction to Networked, Distributed, and Parallel

    Computing Javier Gonzalez-Sanchez, Ph.D. [email protected] Winter 2026 Copyright. These slides can only be used as study material for the class CSC 364 at Cal Poly. They cannot be distributed or used for another purpose. 32