n etwork p rogramming csc- 341 instructor: junaid tariq, lecturer, department of computer science

32
NETWORK PROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

Upload: myrtle-george

Post on 17-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

NETWORK PROGRAMMING

CSC- 341

Instructor:

Junaid Tariq,

Lecturer,

Department of Computer Science

Page 2: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

Lecture 33

Page 3: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

NETWORK COMPONENTS

Physical MediaInterconnecting DevicesComputersNetworking SoftwareApplications

Page 4: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

NETWORKING MEDIA Networking media can

be defined simply as the means by which signals (data) are sent from one computer to another (either by cable or wireless means).

Wide variety of transmission links:Copper Twisted pairCoaxial CableOptical FiberWireless media

Introduction to Computer Networks

Page 5: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

NETWORKING DEVICES HUB, Switches, Routers,

Wireless Access Points, Modems etc.

Introduction to Compute Networks

Page 6: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

COMPUTERS: CLIENTS AND SERVERS In a client/server network

arrangement, network services are located in a dedicated computer whose only function is to respond to the requests of clients.

The server contains the file, print services, application, security, and other services in a central computer that is continuously available to respond to client requests.

Introduction to Computer Networks

Page 7: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

APPLICATIONS E-mail Searchable Data (Web Sites) E-Commerce News Groups Internet Telephony (VoIP) Video Conferencing Chat Groups Instant Messengers Internet Radio

Page 8: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

ADDRESSING AND ROUTING

Address: byte-string that identifies a node usually unique

Routing: forwarding decisions process of determining how to forward

messages to the destination node based on its address

Types of addresses unicast: node-specific broadcast: all nodes on the network multicast: some subset of nodes on the

network

Page 9: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

WRAP-UP

A network can be constructed from nesting of networks

An address is required for each node that is reachable on the network

Address is used to route messages toward appropriate destination

Page 10: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science
Page 11: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

LAYERED TASKSLAYERED TASKS

We use the concept of We use the concept of layerslayers in our daily life. As an in our daily life. As an example, let us consider two friends who communicate example, let us consider two friends who communicate through postal mail. The process of sending a letter to a through postal mail. The process of sending a letter to a friend would be complex if there were no services friend would be complex if there were no services available from the post office. available from the post office.

Page 12: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

LAYERED TASKS

Sender, Receiver and Carrier

Page 13: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

LAYERED TASKS

Hierarchy Higher Layer Middle Layer Lower Layer

Services The Each layer uses the services of the layer

immediately below it.

Page 14: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science
Page 15: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

ORGANIZATION OF AIR TRAVEL

ticket (purchase)

baggage (check)

gates (load)

runway takeoff

airplane routing

ticket (complain)

baggage (claim)

gates (unload)

runway landing

airplane routing

airplane routing

Although this course is about network programming

(and not about networking in general), an understanding

of a complete network model is essential.

Page 16: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

ORGANIZATION OF AIR TRAVEL: A DIFFERENT VIEW

Layers: each layer implements a service via its own internal-layer actions relying on services provided by layer below

ticket (purchase)

baggage (check)

gates (load)

runway takeoff

airplane routing

ticket (complain)

baggage (claim)

gates (unload)

runway landing

airplane routing

airplane routing

Page 17: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

DISTRIBUTED IMPLEMENTATION OF LAYER FUNCTIONALITY

ticket (purchase)

baggage (check)

gates (load)

runway takeoff

airplane routing

ticket (complain)

baggage (claim)

gates (unload)

runway landing

airplane routing

airplane routing

Dep

art

ing

air

port

arr

ivin

g

air

port

intermediate air traffic sites

airplane routing airplane routing

Page 18: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

THE OSI MODELTHE OSI MODEL

Established in 1947, the International Standards Established in 1947, the International Standards Organization (Organization (ISOISO) is a multinational body dedicated to ) is a multinational body dedicated to worldwide agreement on international standards. An ISO worldwide agreement on international standards. An ISO standard that covers all aspects of network standard that covers all aspects of network communications is the Open Systems Interconnection communications is the Open Systems Interconnection ((OSIOSI) model. It was first introduced in the late 1970s. ) model. It was first introduced in the late 1970s.

ISO is the organization.OSI is the model.

Page 19: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

LAYERED ARCHITECTURE

The OSI model is composed of seven layers ; Physical (layer1), Data link (layer2), Network (layer3)

Transport (layer4), Session (layer5), Presentation (layer6), Application (layer7)

Layer Designer identified which networking functions had

related uses and collected those functions into discrete groups that became the layers.

The OSI model allows complete interoperability between layers.

The Each layer uses the services of the layer immediately below it.

Page 20: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

Figure 2.2 Seven layers of the OSI model

Layered Architecture (cont’d)Layered Architecture (cont’d)

All

People

Seem

To

Need

Data

Processing

Page 21: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

PEER-TO-PEER PROCESSES

Layer x on one machine communicates with layer x on another machine - called Peer-to-Peer Processes.

Interfaces between Layers Each interface defines what information and services a layer must provide for the layer above it. Well defined interfaces and layer functions provide modularity to a network

Organizations of the layers Network support layers : Layers 1, 2, 3 User support layer : Layer 5, 6, 7

It allows interoperability among unrelated software systems Transport layer (Layer 4) : links the two subgroups

Page 22: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

OSI ARCHITECTURE

Page 23: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

Figure 2.3 The interaction between layers in the OSI model

Peer-to-peer Processes (cont’d)Peer-to-peer Processes (cont’d)

Page 24: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

Figure 2.4 An exchange using the OSI model

The data portion of a packet at level N-1 carries the whole packet

from level N. – The concept is called encapsulation.

Peer-to-peer Processes (cont’d)Peer-to-peer Processes (cont’d)

Page 25: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

LAYERS IN THE OSI MODELLAYERS IN THE OSI MODEL

In this section we briefly describe the functions of each In this section we briefly describe the functions of each layer in the OSI model.layer in the OSI model.

Physical LayerData Link LayerNetwork LayerTransport LayerSession LayerPresentation LayerApplication Layer

Topics discussed in this section:Topics discussed in this section:

Page 26: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

OSI Model Physical Layer

Page 27: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

PHYSICAL LAYER

Physical layer coordinates the functions required transmit a bit stream over a physical medium.

The physical layer is responsible for movements of individual bits from one hop (node) to the next.

Page 28: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

PHYSICAL LAYER

Physical layer is concerned with the following: (deal with the mechanical and electrical

specification of the primary connections: cable, connector) Physical characteristics of interfaces and medium Representation of bits Data rate : transmission rate Synchronization of bits Line configuration Physical topology Transmission mode

Page 29: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

OSI Model Data Link Layer

Page 30: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

DATA LINK LAYER

The data link layer is responsible for moving frames from one hop (node) to the next.

Page 31: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

DATA LINK LAYER

Major duties Framing Physical addressing Flow control Error control Access control

Page 32: N ETWORK P ROGRAMMING CSC- 341 Instructor: Junaid Tariq, Lecturer, Department of Computer Science

DATA LINK LAYER

Hop-to-hop (node-to-node) delivery