~/ learn/ comp-348/ cards/ Why networks are built in layers
1 of 4

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/e75e5f2c-a0d0-4845-8a8a-9c0edd9bab83/flashcard utf-8 LF