Networking and Object-Oriented Programming II: Understanding Java's Networking API - Prof., Study notes of Computer Science

An overview of networking concepts, focusing on java's object-oriented view and networking api. Topics include networking background, protocols, internet addresses, ports, sockets, urls, connection types, and reliability. Learn about the history of networking, the importance of protocols, and how java supports networking through its api.

Typology: Study notes

Pre 2010

Uploaded on 07/29/2009

koofers-user-m3d-1
koofers-user-m3d-1 🇺🇸

10 documents

1 / 19

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
1
CMSC 132:
Object-Oriented Programming II
Networking
Department of Computer Science
University of Maryland, College Park
2
Advanced Programming Concepts
Objected-oriented support in Java for
Exception handling
Streams
Threads
Graphics user interfaces (GUIs)
Networking
Look at networking as example of OO design
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Networking and Object-Oriented Programming II: Understanding Java's Networking API - Prof. and more Study notes Computer Science in PDF only on Docsity!

1

CMSC 132:

Object-Oriented Programming II

Networking

Department of Computer Science

University of Maryland, College Park

2

Advanced Programming Concepts

Objected-oriented support in Java for

Exception handling Streams Threads Graphics user interfaces (GUIs) Networking

Look at networking as example of OO design

3

Overview

Networking

Background Concepts Java’s objected-oriented view Java’s networking API (Application Program Interface) Network applications

This lecture

Next lecture

4

Networking Background

Definition

Set of computers using common protocols to communicate over connecting media

History

1969 ARPANET

1986 NSFnet 1995 Internet

7

Protocols – Email Delivery

8

Protocol – HTTP GET (Web Page)

Client connects to server on port 80 GET /~pugh/index.html HTTP/1.

Server responses with HTTP headers HTTP/1.1 200 OK Date: Mon, 20 Feb 2006 03:47:44 GMT Server: Apache Last-Modified: Wed, 15 Feb 2006 01:17:09 GMT ETag: "9b2b1c-948-1222af40" Accept-Ranges: bytes Content-Length: 2376 Connection: close Content-Type: text/html; charset=ISO-8859-

Followed by blank line, then contents of response

9

Network Model

Open Systems

Interconnection

(OSI) model

Multiple layers (7) One function each Each layer relies on previous layer

Designed to

reduce complexity

using abstraction

10

Network Model – Layers

Physical layer

Transmit data as 0’s and 1’s over connection

Data-link layer

Between two physically connected computers

Network layer

Between any two computers connected to network

Transport layer

Deliver network data to application

Application layer

Between two applications using network

13

Internet (IP) Address

Problem

Running out of 32-bit IP addresses Caused by initial address allocation Stanford & MIT given more IP addresses than China

Switching to 128-bit IP addresses in IPv

1+ million addresses per square meter on Earth

14

IP Address – DNS

Domain Name System (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

15

IP Address – DHCP

Dynamic Host Configuration Protocol (DHCP)

Protocol used by networked computers to obtain Unique IP addresses Default router, subnet mask IP addresses for DNS servers DHCP server on local network Used when computers first connect to network Settings (leases) periodically refreshed

16

IP Address – NAT

Network Address Translation (NAT)

Rewriting source / destination IP addresses As data passes through router Permits sharing of single IP address among multiple computers Used in home networking (NAT box)

19

Sockets

Application-level abstraction

Represents network connection Implemented in software Supports both UDP and TCP protocols

History

Introduced in Berkley UNIX in 1980s Networking API

20

Sockets

Socket is bound to port number

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

21

Uniform Resource Locators (URLs)

Represent web resources

Web pages Arbitrary files …

Examples

http://www.cs.umd.edu/index.html ftp://www.cs.umd.edu/pub/doc/csd_policies.pdf https://login.yahoo.com/ file://dir/my.txt

22

Uniform Resource Locators (URLs)

Consists of

Protocol http ftp https (secure http) file … IP address (or domain name) Port (optional) http://www.cs.umd.edu:80/ Reference to anchor (optional)

25

Connection Oriented

Protocol

26

Connection Oriented

Advantages

Simpler scheme Easier to use Higher quality communication Less likely to lose data (at network layer)

27

Packet Oriented

Approach

Break message up into packets Transmit packets separately Assemble packets at destination

Also called

Packet switching Connectionless

Example

US Mail VOIP (Voice over IP)

28

Packet Oriented

Protocol

31

Internet

32

Internet Protocol (IP)

Packet oriented

Packets routed between computers

Unreliable

33

User Datagram Protocol (UDP)

Packet oriented

Message split into datagrams

Send datagrams as packets on network layer

Unreliable but fast

Application must deal with lost packets

Examples

Ping Streaming multimedia Online games

34

Transmission Control Protocol (TCP)

Connection oriented

Message split into datagrams

Send datagrams as packets on network layer

Provides illusion of reliable connection

Extra messages between sender / recipient Resend packets if necessary Ensure all packets eventually arrive Store packets and process in order

37

Reliability

Unreliable

Data not guaranteed to Arrive ⇒ lost data Arrive in order ⇒ out of order data Less overhead Faster Transfers responsibility to higher layer Extra work for higher layer Compensate with timeouts Estimate packet lost if longer than average round trip

38

Reliability

Reliable layers

Data-link

Unreliable layers

Physical Network

Can be either

Transport Reliable ⇒ TCP Unreliable ⇒ UDP Application