Memra
academic · advanced

COMP 348 — Practical Java Network Programming

Sockets, protocols, and servers — typed line by line

A full Java networking course: the TCP/IP layer model and which java.net class lives at which layer, stream and reader I/O, the concurrency a server actually needs (threads, executors, and why the accept loop must not block), URIs and URLConnection, HTTP as a protocol you read and write by hand, client and server sockets, a working multithreaded HTTP server, protocol design as a finite state machine, RMI, JavaMail, non-blocking I/O with buffers, channels and selectors, and TLS, UDP and multicast. Every Java idiom is typed, not skimmed, and every module carries the exam framing and the pitfall that costs marks.

0 / 68 lessons
We'll stop scheduling reviews for after it.

The network underneath Java

35 cards
  1. Why networks are built in layers 9 min ◈ 4
  2. The four layers, one at a time 10 min ◈ 5
  3. IP, TCP, and UDP 11 min ◈ 5
  4. Addresses, ports, and names 10 min ◈ 5
  5. The internet you actually deploy into 10 min ◈ 5
  6. InetAddress: resolving names and addresses 9 min ◈ 5
  7. Inspecting an address, and every address this host has 10 min ◈ 6

Streams: the I/O every socket speaks

24 cards
  1. OutputStream, and why flush() is not optional 10 min ◈ 4
  2. InputStream and the shape of a read 10 min ◈ 4
  3. Filter streams: chaining, buffering, and data streams 11 min ◈ 5
  4. Where bytes become text: readers, writers, encodings 12 min ◈ 5
  5. Your first network program 11 min ◈ 6

Concurrency for network programs

30 cards
  1. Why network code is concurrent, and how to start a thread 10 min ◈ 4
  2. Getting a result back out 11 min ◈ 5
  3. Synchronization, and choosing what to lock 12 min ◈ 5
  4. Not locking: confinement, immutability, safe collections, deadlock 11 min ◈ 5
  5. Thread pools: `ExecutorService`, `Callable`, `Future` 12 min ◈ 5
  6. Worked build: a pooled weblog analyser 14 min ◈ 6

URLs, URIs, and URLConnection

29 cards
  1. URI, URL, and relative references 10 min ◈ 5
  2. The URL class: construct, split, read 11 min ◈ 5
  3. Equality, the URI class, and form encoding 11 min ◈ 4
  4. URLConnection: the lifecycle and reading data 10 min ◈ 4
  5. Headers, charsets, and HttpURLConnection 12 min ◈ 5
  6. Worked build: a source viewer that greps 13 min ◈ 6
  1. The HTTP exchange, by hand 10 min ◈ 5
  2. The request: line, methods, headers, body 11 min ◈ 5
  3. The response: status line, codes, and content types 11 min ◈ 6
  4. Caching: freshness, revalidation, and ResponseCache 10 min ◈ 5
  5. Keep-alive, chunking, and cookies 12 min ◈ 6

Sockets for clients

23 cards
  1. What a `Socket` is 10 min ◈ 3
  2. Reading from a server: a line-protocol client 12 min ◈ 5
  3. Writing to a server: request/response turns 12 min ◈ 5
  4. Constructing, connecting, and interrogating a socket 10 min ◈ 4
  5. Socket options and the exception family 12 min ◈ 6

Sockets for servers

26 cards
  1. `ServerSocket` and the accept loop 11 min ◈ 5
  2. One at a time is a queue: going multithreaded 11 min ◈ 5
  3. Thread-pooled servers 11 min ◈ 5
  4. Binding, options, and clean shutdown 10 min ◈ 5
  5. Logging a server 12 min ◈ 6

Build a working HTTP server

26 cards
  1. The smallest server that speaks HTTP 10 min ◈ 5
  2. Parsing the request line and mapping a path — safely 12 min ◈ 5
  3. Serving many files: media types and binary output 12 min ◈ 5
  4. The errors a server owes its clients 10 min ◈ 5
  5. Worked build: access logging, end to end 12 min ◈ 6

Protocol design as an FSM

19 cards
  1. What a protocol specification must pin down 11 min ◈ 4
  2. A session as a finite-state machine 11 min ◈ 4
  3. Writing the specification document 12 min ◈ 4
  4. Worked build: the Poem-of-the-Day server 14 min ◈ 7

Java RMI

25 cards
  1. Distributed objects, and what a stub is 10 min ◈ 5
  2. The remote interface and its implementation 10 min ◈ 5
  3. Exporting and the registry 11 min ◈ 5
  4. Parameters, returns, and what actually crosses the wire 11 min ◈ 4
  5. Worked build: the prime service, and its failure modes 13 min ◈ 6

JavaMail

20 cards
  1. The three mail protocols, at the telnet level 11 min ◈ 4
  2. Sending: Session, MimeMessage, Transport 12 min ◈ 5
  3. Attachments: MimeMultipart and MimeBodyPart 11 min ◈ 5
  4. Receiving: Store, Folder, Message, and flags 12 min ◈ 6

Non-blocking I/O

25 cards
  1. Why non-blocking I/O — and the case against it 10 min ◈ 4
  2. Buffers: four numbers and one invariant 12 min ◈ 5
  3. ByteBuffer in practice 11 min ◈ 5
  4. Channels: SocketChannel and ServerSocketChannel 12 min ◈ 5
  5. Selectors: one thread, many connections 13 min ◈ 6

TLS, UDP, multicast

33 cards
  1. What TLS actually gives you 10 min ◈ 5
  2. SSLSocket clients and HTTPS 11 min ◈ 5
  3. SSLServerSocket and keystores 11 min ◈ 5
  4. UDP: when losing packets is the right trade 10 min ◈ 5
  5. DatagramPacket and DatagramSocket 12 min ◈ 7
  6. Multicast: one send, many receivers 12 min ◈ 6
NORMAL ~/memra/learn/comp-348 utf-8 LF