csce 515: computer network programmingwyxu/515/csce515-aug23.pdf · 2007. 8. 25. · csce515 –...

30
CSCE 515: Computer Network Programming Wenyuan Xu http://www.cse.sc.edu/~wyxu/csce515f07.html Department of Computer Science and Engineering University of South Carolina

Upload: others

Post on 17-Oct-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE 515:Computer Network ProgrammingWenyuan Xu

http://www.cse.sc.edu/~wyxu/csce515f07.htmlDepartment of Computer Science and EngineeringUniversity of South Carolina

Page 2: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Course Goal:Understand the basic principles of computer networks

Network basicBasic design principles in network protocolsInternet protocolsWireless network protocols

Study the programming aspects of computer networksSocket programmingInter-process communication

Understand how network research is doneHow to determine what is important What are the trend

Page 3: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

AdministrativeCourse website:

http://www.cse.sc.edu/~wyxu/csce515f07.htmlAnnouncementsHomework AssignmentsLecture NotesLinks to required/recommended readings

How to reach me:Email: [email protected] Hours: TTH 3:30am-4:30pm or by appointmentOffice: SWGN 3A54

Teaching assistant: TBAOffice Hours: TBAPrerequisites: CSCE 311 Operating Systems

Page 4: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Tentative topicsOSI and TCP/IP Network modelsTCP/IPSocket programmingThe Internet and Internet protocolWeb programmingOther network programming

Page 5: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Grading10% Homework (2)

Q&A

50% Computer Projects (5 – some big, some small)

15% Midterm

25% Final: closed book, and comprehensive.

Honor code:All submitted work should be yours! NO sharing of codeDo not copy code from InternetDiscussion is encouraged

Page 6: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Homework & projectsProgramming Environments

Unix workstation lab.: 1D39 (Sun + Linux)1D45 (Linux)

All students should have an account on Computer Science and Engineering Department Unix workstationsAll grading will be done on CSE Linux!

Submission should be via Drop BoxMake sure you understand how to submit (practice first)!

Directions for submission will be posted on the course home page with the first assignment.

Page 7: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Project gradingIt is expected that everyone is a good programmerComment your code!Your code should be readable, structured!25% of the grade depends on the quality of the code.

Is the code easy to understand?Is it easy to make a small change of the functionality?Can code handle unexpected input, exceptions?

Java programs must come with a shell script that starts them:

Sets CLASSPATH to the right valueRemember that I will try your programs in a directory with a different name than you!

Page 8: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Project grading25% of the grade depends on documentationDocumentations must contain:

Your name and student numberHow to use your programsWhich program does what, which parameters are needed, screenshotsA description of your program’s design

Documentations must not contain:Your code in words“After spending the whole weekend and today at my girlfriend’s house trying to solve the exercises for the Network Programming course which are due today, I must confess that I did not succeed in solving them all”.

Page 9: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Email PoliciesMake sure you put your course (CSCE515) in the subject of the message.

Remember that it is not my emergency if you need help at the last minute. I may check my messages in time to help you make a deadline, but this may not necessarily be the case.

Ask specific question instead of general question.Bad example: “I don’t know why it does not work?”In general, I will answer quick questions sooner than one that will take a long time to answer

In general I will monitor and respond to email during office hours, but in-person students will take precedence.

Page 10: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Your Best StrategyCome to every lecture

Read articles related to network protocols and network programming

Do not wait till last minute to prepare for exam or work on project

Enjoy the fun!

Page 11: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Lectures need your help!Ask questions

Correct Wenyuan! *Extra credit!

Make suggestions!

Read something interesting and relevant to this course? Announce it in class!

Page 12: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

Introduction

Page 13: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

What is network?The term network can refer to any interconnected group or system.

A computer network is composed of multiple computers connected together using a telecommunication system.

“…communication system for connecting end-systems”

End-systems a.k.a. “hosts”PCs, workstationsdedicated computersnetwork components

Interconnection may be any medium capable of communicating information:Copper wireLasers (optical fiber)Radio /Satellite linkCable (coax)

Example: Ethernet.

Page 14: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Why network?Sharing resources

Resources become available regardless of the user’s physical location (server based, peer2peer)

Load Sharing/utilizationJobs processed on least crowed machineResource can be shared

High reliabilityAlternative source of supply (multiple copies)

Computer as a communication tools

Page 15: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

What is Internet?What is internet?

Network of networksWhat is the Internet?

A global internet based on IP protocolInternet applications:

EmailFile transferNewsgroupFile sharingResource distributionWorld wide webVideo conferenceGaming

local ISP

regional ISP

companynetwork

Page 16: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Emerging networksEmbedded networks

Every physical object is connectedOpen/close your garage via networkKnow which milk can is about to expire

Sensor networksPhysical space is instrumented and connected

Detect presence of people in a room and set temperature accordinglyKnow exactly how many cars on Route 26

Disposable networksOne time use network

Disaster recovery, smart dust

Page 17: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

CharacteristicsLots of them (density)Cheap unreliable elementsRun on batteriesLocation becomes a key attributeInformation sensing around users

Page 18: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Wide variety of types of networksCircuit switched

dedicated circuit per callperformance (guaranteed) call setup requiredtelephone system

Packet switched:data sent thru net in discrete “chunks”user A, B packets share network resourcesresources used as neededstore and forward: packets move one hop at a timeThe Internet (TCP/IP)

Page 19: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

Network Protocols

Page 20: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

What’s a protocol?a human protocol and a computer network protocol:

Hi

HiGot thetime?2:00

TCP connectionreq.

TCP connectionreply.

Get http://gaia.cs.umass.edu/index.htm

<file>

timeprotocols define format, order of msgs sent and received among

network entities, and actions taken on msg transmission, receipt

Page 21: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Organization of air travelticket (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 22: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Organization of air travel: a different view

Layers: each layer implements a servicevia its own internal-layer actionsrelying 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 23: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

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

arti

ng a

irpo

rt

arri

ving

air

port

intermediate air traffic sitesairplane routing airplane routing

Page 24: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Protocol Stack: ISO OSI Model

Application

Presentation

Session

Transport

Network

Data link

Physical

ISO: the International Standards OrganizationOSI: Open Systems Interconnection Reference Model (1984)

Header encapsulation and stripping

Data

DataAHPH

TH

NH

SH DataAHPH

SH DataAHPH

TH SH DataAHPH

DH DTNH TH SH DataAHPH

DH DH DTNH TH SH DataAHPH

DataAH

Page 25: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Communicating between End Hosts

Application

Presentation

Session

Transport

Network

Data link

Physical

Application

Presentation

Session

Transport

Network

Data link

Physical

Network

Data link

Physical

Host Host

Router

Application Protocol

Presentation Protocol

Session Protocol

Transport Protocol

interface

Page 26: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Why layering?Divide a task into pieces and then solve each piece independently (or nearly so).

Establishing a well defined interface between layers makes porting easier.

Functions of each layer are independent of functions of other layersThus each layer is like a module and can be developed independently

Each layer builds on services provided by lower layersThus no need to worry about details of lower layers -- transparent to this layer

Major Advantages:Code ReuseEases maintenance, updating of system

Page 27: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Programs & ProcessesA program is an executable file.

A process or task is an instance of a program that is being executed.

A single program can generate multiple processes.

Page 28: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Client - ServerA server is a process - not a machine !

A server waits for a request from a client.

A client is a process that sends a request to an existing server and (usually) waits for a reply.

Page 29: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Client - Server ExamplesServer returns the time-of-day.

Server returns a document.

Server prints a file for client.

Server does a disk read or write.

Server records a transaction.

Page 30: CSCE 515: Computer Network Programmingwyxu/515/CSCE515-Aug23.pdf · 2007. 8. 25. · CSCE515 – Computer Network Programming – 2007 Fall Project grading 25% of the grade depends

CSCE515 – Computer Network Programming – 2007 Fall

Assignment & Next timeReading:

How NOT to go about a programming assignmentTI Ch.1

Next Lecture:OSI modelIP address