~/ learn/ comp-348/ cards/ COMP 348 — Practical Java Network Programming
1 of 342

The layer map in Java types — the four lines the exam question is really asking for

The layer map in Java types — the four lines the exam question is really asking for

Answer

// internet layer: an address, nothing more InetAddress host = InetAddress.getByName("example.org"); // transport layer: TCP and UDP endpoints Socket tcp = new Socket(host, 80); DatagramSocket udp = new DatagramSocket(); // application layer: naming and protocol URI page = URI.create("http://example.org/index.html");

Four types, three layers. `InetAddress` is the only internet-layer object Java hands you and it carries no data — it is an address. `Socket` and `DatagramSocket` are your two transport choices. `URI` (and `URLConnection`, module 4) name and drive an application protocol. There is deliberately no Java type for the host-to-network layer.

Harold 4e ch1 §The Layers of a Network; JDK javadoc java.net

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/ae6cb29f-1c6b-4a8c-9b85-6b037f4ecb79/flashcard utf-8 LF