













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














Networking
Designed with multiple layers of abstraction Underlying medium is unreliable, packet oriented Provides two views Reliable, connection oriented (TCP) Unreliable, packet oriented (UDP)
Object-oriented classes & API Sockets, URLs Extensive networking support
Internet (IP) Address
Running out of 32-bit IP addresses Caused by initial address allocation Stanford & MIT initially given more IP addresses than China fixed in 2000 Univ. of Maryland is currently assigned 131, IP addresses
1+ million addresses per square meter on Earth
IP Address โ DNS
Protocol for translating domain names to IP addresses Example: cs.umd.edu โ 128.8.128. Multiple DNS servers on internet DNS server may need to query other DNS servers edu DNS server queries umd.edu server to find cs.umd.edu
Sockets
Represents network connection Implemented in software Supports both UDP and TCP protocols
Introduced in Berkley UNIX in 1980s Networking API
Sockets
Receives data packet Relays to specific port port port port port port TCP or UDP port #, data Packet app app app app app Transport Layer
Uniform Resource Locators (URLs)
Protocol http: https: (secure http) file: โฆ IP address (or domain name) Port (optional, 80 if not specified) http://www.cs.umd.edu:80/ Reference to anchor (optional) Query terms
Internet Connections
Transmission Control Protocol (TCP)
Despite unreliability of underlying IP (network)
ftp (file transfer) ssh (remote secure shell) http (web)
User Datagram Protocol (UDP)
messages are small if a packet is lost, would rather just lose it than delay receipt of next packet
Client / Server Model
Initiates communication Requests services
Receives communication Provides services
Master / worker Peer-to-peer (P2P)
Client Programming
Java Networking Classes IP addresses InetAddress Packets DatagramPacket Sockets Socket - TCP client sockets ServerSocket - TCP server sockets DatagramSocket - UDP sockets (server or client) Sockets transfer data via Java I/O streams URL Connection Classes High-level description of network service Access resource named by URL Examples URLConnection โ Reads resource HttpURLConnection โ Handles web page JarURLConnection โ Manipulates Java Archive
Java Networking Examples TCP Client/Server: See tcpServerClient package UDP Client/Server: See udpServerClient package URL Reader: See urlReader package Toy Web Server: See toyWebServer package