~/ learn/ comp-348/ cards/ The network underneath Java
1 of 35

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/0a211fb2-017c-46e5-89b1-d8698ca35a93/flashcard utf-8 LF