csc383 computer networks

38
CSC383 Computer CSC383 Computer Networks Networks Dr. Allen M. Johnson, Jr. Dr. Allen M. Johnson, Jr.

Upload: tehya

Post on 16-Jan-2016

46 views

Category:

Documents


0 download

DESCRIPTION

CSC383 Computer Networks. Dr. Allen M. Johnson, Jr. History…. 1 st networks designed to share large-scale computational power 1 st commercially available network system was IBM’s PROFS system. (mainframes) Late 1960s, ARPA started investigating data networking. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CSC383 Computer Networks

CSC383 Computer NetworksCSC383 Computer Networks

Dr. Allen M. Johnson, Jr.Dr. Allen M. Johnson, Jr.

Page 2: CSC383 Computer Networks

History…History…

11stst networks designed to share large-scale networks designed to share large-scale computational powercomputational power

11stst commercially available network system commercially available network system was IBM’s PROFS system. (mainframes)was IBM’s PROFS system. (mainframes)

Late 1960s, ARPA started investigating Late 1960s, ARPA started investigating data networking.data networking.– Idea of networking computers of different Idea of networking computers of different

architecturesarchitectures– Thought to be a crazy idea by manyThought to be a crazy idea by many

Page 3: CSC383 Computer Networks

… … History…History…

In the late 1970s inexpensive In the late 1970s inexpensive minicomputers provided time-sharing minicomputers provided time-sharing facilities to people within a department.facilities to people within a department.

Organizations installed Local Area Organizations installed Local Area Networks (LANs) to interconnect these Networks (LANs) to interconnect these machines together. machines together.

Page 4: CSC383 Computer Networks

……History…History…

ARPA chose to investigate a revolutionary ARPA chose to investigate a revolutionary approach, known as approach, known as packet switchingpacket switching..

They hired people to work on network They hired people to work on network research and contractors to turn the designs research and contractors to turn the designs into a working system called the into a working system called the ARPANETARPANET..

This was so successful that ARPA This was so successful that ARPA continued funding research into a continued funding research into a networking technology called networking technology called internetworkinginternetworking. .

Page 5: CSC383 Computer Networks

……HistoryHistory

By the 1970s, internetworking was the By the 1970s, internetworking was the focus of ARPA research and the focus of ARPA research and the InternetInternet had emerged. had emerged.

ARPA continued funding research into the ARPA continued funding research into the 1980s, 1980s,

Internet became a commercial success in Internet became a commercial success in the 1990s. the 1990s.

Page 6: CSC383 Computer Networks

Growth of InternetGrowth of Internet

The Internet has grown from an early research The Internet has grown from an early research prototype into a global communications system prototype into a global communications system that connects every country. that connects every country.

By 1999, the Internet was growing so fast that a By 1999, the Internet was growing so fast that a new computer was added to the Internet every new computer was added to the Internet every second. second.

Page 7: CSC383 Computer Networks

……Growth of InternetGrowth of Internet

                                                                                                                                           

                                            

Page 8: CSC383 Computer Networks

……Growth of InternetGrowth of Internet

Page 9: CSC383 Computer Networks

Protocols and LayeringProtocols and Layering

Computer networks are complex systems Computer networks are complex systems including both hardware and software. including both hardware and software.

Designers divided the communication Designers divided the communication problem into subparts, called problem into subparts, called layerslayers, with the , with the interfaces between the layers defined by interfaces between the layers defined by protocolsprotocols. .

Page 10: CSC383 Computer Networks

TCP/IP 5-layer Reference ModelTCP/IP 5-layer Reference Model

Page 11: CSC383 Computer Networks

TCP/IP Layered ModelTCP/IP Layered Model physical layer corresponds to basic network hardware.physical layer corresponds to basic network hardware. Network interface layer specifies how data is divided into Network interface layer specifies how data is divided into

frames for transmission over a network. frames for transmission over a network. Internet layer protocols specify the format of packets sent Internet layer protocols specify the format of packets sent

across an internet as well as the mechanisms used to across an internet as well as the mechanisms used to forward packets from a computer through one or more forward packets from a computer through one or more routers to a final destination. routers to a final destination.

Transport layer specifies how to provide reliable transfer Transport layer specifies how to provide reliable transfer and the and the Transmission Control ProtocolTransmission Control Protocol (TCP) software also (TCP) software also provides additional facilities required by higher-level provides additional facilities required by higher-level applications. applications.

Application layer specifies how applications use the Application layer specifies how applications use the Internet. Internet.

Page 12: CSC383 Computer Networks

Probing the InternetProbing the Internet

Simplest probing tool is the Simplest probing tool is the Packet InterNet Packet InterNet GroperGroper, or , or pingping. .

According to the Internet requirements According to the Internet requirements document document [RFC 1122] [RFC 1122] , every TCP/IP stack , every TCP/IP stack should implement such a program. should implement such a program.

Page 13: CSC383 Computer Networks

PING Command ExamplePING Command Examplepenguin(101)% ping -c5 www.netbook.cs.purdue.edu PING lucan.cs.purdue.edu (128.10.19.20) from 193.61.29.127: 56(84) bytes of data 64 bytes from lucan.cs.purdue.edu (128.10.19.20): icmp_seq=1 ttl=235 time=131 ms 64 bytes from lucan.cs.purdue.edu (128.10.19.20): icmp_seq=2 ttl=235 time=131 ms 64 bytes from lucan.cs.purdue.edu (128.10.19.20): icmp_seq=3 ttl=235 time=131 ms 64 bytes from lucan.cs.purdue.edu (128.10.19.20): icmp_seq=4 ttl=235 time=131 ms 64 bytes from lucan.cs.purdue.edu (128.10.19.20): icmp_seq=5 ttl=235 time=131 ms --- lucan.cs.purdue.edu ping statistics --- 5 packets transmitted, 5 received, 0% loss, time 4008ms rtt min/avg/max/mdev = 131.394/131.742/131.978/0.317 ms penguin(102)%

• -c5 instructs ping to stop after sending five probes

• summary on the first line indicates an alternative name for the target is lucan.cs.purdue.edu, that its IP address is 128.10.19.20, and it’s sending 56 bytes of data in an 84-byte IP datagram.

•The next five lines are the responses received. These indicate that there are approximately 20 (= 255 - 235) hops between penguin.dcs.bbk.ac.uk and www.netbook.cs.purdue.edu, and that the average round-trip time is 131 ms.

Page 14: CSC383 Computer Networks

What Good Is PINGWhat Good Is PING ConsCons

– Little info for average userLittle info for average user– Not good as debug toolNot good as debug tool

» Output occurs only when computer respondsOutput occurs only when computer responds

» Fails if network is congestedFails if network is congested

» PING cannot determine cause of problemPING cannot determine cause of problem

» Some companies configure systems to reject pingsSome companies configure systems to reject pings

ProsPros– Determine which part of network is still operatingDetermine which part of network is still operating– Results help pinpoint failure quickleyResults help pinpoint failure quickley

Page 15: CSC383 Computer Networks

TracerouteTraceroute

Determine intermediate computers along Determine intermediate computers along the waythe way

Uses same arguments as PING (remote Uses same arguments as PING (remote computers name or address)computers name or address)

Shows how the hops between source and Shows how the hops between source and destination.destination.

http://www.net.cmu.edu/cgi-bin/netops.cgihttp://www.net.cmu.edu/cgi-bin/netops.cgi

Page 16: CSC383 Computer Networks

Figure 2.6

                                                                                                                                                                                          

                  

Page 17: CSC383 Computer Networks

Chapter 3 IntroductionChapter 3 Introduction

Use of a network requires programs (and Use of a network requires programs (and systems) that are “network-aware.”systems) that are “network-aware.”

Some applications are usually provided with Some applications are usually provided with machines (e.g. web clients, e-mail clients, file machines (e.g. web clients, e-mail clients, file sharing).sharing).

New custom applications must use the interface New custom applications must use the interface (API) to the network facilities provided by the (API) to the network facilities provided by the system.system.

We will look at a simple API and three sample We will look at a simple API and three sample applications (both the client and the server).applications (both the client and the server).

Page 18: CSC383 Computer Networks

Network CommunicationNetwork Communication

Networks are the mechanisms that transmit data Networks are the mechanisms that transmit data from one point to another.from one point to another.

Logically, networks are (or should be) passive, Logically, networks are (or should be) passive, and do not understand, act on, or modify the data and do not understand, act on, or modify the data being moved.being moved.

There are two ends of a network communication, There are two ends of a network communication, each associated with an application program that each associated with an application program that understands the generation and interpretation of understands the generation and interpretation of the data being moved across the network.the data being moved across the network.

Page 19: CSC383 Computer Networks

Client-Server ComputingClient-Server Computing

The two applications that communicate using a The two applications that communicate using a network must locate each other.network must locate each other.

Typically, one application (the server) starts and Typically, one application (the server) starts and then waits for the other application (the client) to then waits for the other application (the client) to contact it.contact it.

This arrangement is usually called the This arrangement is usually called the client-client-server paradigmserver paradigm, or just , or just client-server computingclient-server computing..

The client must, of course, be able to locate the The client must, of course, be able to locate the server for this arrangement to work.server for this arrangement to work.

Page 20: CSC383 Computer Networks

Addressing Internet ApplicationsAddressing Internet Applications Each network server application has a two-part address of Each network server application has a two-part address of

the form (the form (computercomputer,,applicationapplication).). The The computercomputer part of the address identifies the particular part of the address identifies the particular

computer on which the application is running. This can be computer on which the application is running. This can be provided in symbolic (e.g. apollo.unomaha.edu) or numeric provided in symbolic (e.g. apollo.unomaha.edu) or numeric (e.g. 137.48.1.12) form.(e.g. 137.48.1.12) form.

The application part of the address identifies the particular The application part of the address identifies the particular application. It, too, can be provided symbolically or application. It, too, can be provided symbolically or numerically.numerically.

When transmitted on a network, the (When transmitted on a network, the (computercomputer,,applicationapplication) ) address is always sent in binary.address is always sent in binary.

Page 21: CSC383 Computer Networks

Communication ParadigmCommunication Paradigm

Most Internet applications follow this basic Most Internet applications follow this basic sequence of operations for communication:sequence of operations for communication:– The server starts first, and waits for contact from a The server starts first, and waits for contact from a

client.client.– The client contacts the server by specifying its The client contacts the server by specifying its

location and requesting communication.location and requesting communication.– The client and the server exchange messages.The client and the server exchange messages.– After they finish, the client and server each send an After they finish, the client and server each send an

end-of-fileend-of-file to terminate communication. to terminate communication. Functions are provided in the class library on Functions are provided in the class library on

apollo to perform each of these tasks.apollo to perform each of these tasks.

Page 22: CSC383 Computer Networks

An Example Application Program InterfaceAn Example Application Program Interface The term “application program interface,” or The term “application program interface,” or

API, is used to describe the set of operations API, is used to describe the set of operations available (in a particular programming available (in a particular programming domain) to a programmer.domain) to a programmer.

The simplified API presented in the textbook The simplified API presented in the textbook hides much of the complexity in network hides much of the complexity in network programming, but also doesn’t provide the programming, but also doesn’t provide the richness of the usual networking API. We richness of the usual networking API. We will see more details in later chapters.will see more details in later chapters.

Page 23: CSC383 Computer Networks

Example API OverviewExample API Overview

Operation Meaningawait_contact used by server to wait for a contactmake_contact used by client to contact a servercname_to_comp translate a computer name to an

equivalent internal binary valueappname_to_appnum translate a program name to an

equivalent internal binary valuesend used by client or server to send datarecv used by client or server to receive datasend_eof used by client or server after all data

has been sent.

Page 24: CSC383 Computer Networks

An Intuitive Look at the APIAn Intuitive Look at the API

The application actions usually follow this pattern:The application actions usually follow this pattern:– The server calls The server calls await_contactawait_contact to wait for contact from to wait for contact from

a client. The client calls a client. The client calls make_contactmake_contact to establish the to establish the connection. [The server is said to be connection. [The server is said to be blockedblocked until the until the contact is made.]contact is made.]

– Once contact is made, the applications use Once contact is made, the applications use sendsend and and recvrecv to exchange data. [The to exchange data. [The protocolprotocol dictates when dictates when each application sends or receives.]each application sends or receives.]

– Once the data exchange is complete, the client or the Once the data exchange is complete, the client or the server terminates the connection by calling server terminates the connection by calling send_eofsend_eof. . The other application detects the termination of the The other application detects the termination of the communication when communication when recvrecv returns 0. returns 0.

Page 25: CSC383 Computer Networks

A Trivial ExampleA Trivial Example

Page 26: CSC383 Computer Networks

API Definition – Data TypesAPI Definition – Data Types

There are three data types (in addition to the There are three data types (in addition to the usual integer, character, and real data types) used usual integer, character, and real data types) used in the API:in the API:–appnumappnum: a binary value used to identify an : a binary value used to identify an

application [this is really a application [this is really a port numberport number].].–computercomputer: a binary value used to identify a : a binary value used to identify a

computer [this is really an computer [this is really an Internet Protocol addressInternet Protocol address, , or or IP addressIP address.].]

–connectionconnection: a value used to identify one : a value used to identify one endpoint of a connection between a client and a server endpoint of a connection between a client and a server [normally this identifies a [normally this identifies a socketsocket data structure]. data structure].

Page 27: CSC383 Computer Networks

API Definition – API Definition – await_contactawait_contact

A server calls A server calls await_contactawait_contact to wait to wait for a contact from a client. The function for a contact from a client. The function expects one argument of type expects one argument of type appnumappnum, and , and returns a returns a connectionconnection which is then used which is then used in in sendsend, , recvrecv, and , and send_eofsend_eof functions. functions.

connection await_contact connection await_contact (appnum a)(appnum a)

Page 28: CSC383 Computer Networks

API Definition – API Definition – make_contactmake_contact

A client calls A client calls make_contactmake_contact to establish to establish contact with a server. The arguments identify contact with a server. The arguments identify the the computercomputer on which the server is running, on which the server is running, and the application number to be contacted. and the application number to be contacted. The function returns a connection used for The function returns a connection used for sendsend, , recvrecv, and , and send_eofsend_eof by the client. by the client.

connection make_contact (computer connection make_contact (computer c, appnum a)c, appnum a)

Page 29: CSC383 Computer Networks

API Definition – API Definition – appname_to_appnumappname_to_appnum

This function is used to translate from a This function is used to translate from a predefined human-readable name [character predefined human-readable name [character string] to a binary application number. Standard string] to a binary application number. Standard application names are defined in the /etc/services application names are defined in the /etc/services file on a UNIX system. It takes a string argument file on a UNIX system. It takes a string argument and returns the binary application number.and returns the binary application number.

appnum appname_to_appnum (char appnum appname_to_appnum (char *name)*name)

Page 30: CSC383 Computer Networks

API Definition – API Definition – cname_to_compcname_to_comp

This function translates a symbolic This function translates a symbolic computer name (computer name (cnamecname) to the equivalent ) to the equivalent binary form (which is returned) of type binary form (which is returned) of type computercomputer..

computer cname_to_comp (char computer cname_to_comp (char *cname)*cname)

Page 31: CSC383 Computer Networks

API Definition – API Definition – sendsend

SendSend arranges to transmit data (a sequence of arranges to transmit data (a sequence of nn bytes in a char array bytes in a char array bufbuf) over an ) over an established connection established connection cc, returning the number , returning the number of bytes actually transmitted. The last of bytes actually transmitted. The last argument is always argument is always 00 in this simplified API. in this simplified API.

int send (connection c, char int send (connection c, char *buf,*buf,

int n, 0)int n, 0)

Page 32: CSC383 Computer Networks

API Definition – API Definition – recvrecv

RecvRecv receives at most receives at most nn bytes of data from a bytes of data from a connection connection cc, placing it in a char array , placing it in a char array bufbuf, and , and returning the number of bytes received and stored. returning the number of bytes received and stored. RecvRecv will return 0 only when the end of file is will return 0 only when the end of file is reached, and a negative value when an error reached, and a negative value when an error occurred (e.g. occurred (e.g. recvrecv without a valid connection). without a valid connection).

int recv (connection c, char *buf,int recv (connection c, char *buf,

int n)int n)

Page 33: CSC383 Computer Networks

API Definition – API Definition – recvlnrecvln

RecvlnRecvln reads one line of data (terminated by an reads one line of data (terminated by an end of line character) from a connection end of line character) from a connection cc into a into a char array char array bufbuf; no more than ; no more than nn-1 bytes will be -1 bytes will be read (allowing one byte for string termination). read (allowing one byte for string termination). RecvlnRecvln uses uses recvrecv to read one byte at a time. to read one byte at a time.

int recvln (connection c, char int recvln (connection c, char *buf,*buf,

int n)int n)

Page 34: CSC383 Computer Networks

API Definition – API Definition – send_eofsend_eof

Send_eofSend_eof terminates the connection terminates the connection cc, , returning a negative number if an error returning a negative number if an error occurred.occurred.

int send_eof (connection c)int send_eof (connection c)

Page 35: CSC383 Computer Networks

The ECHO ApplicationThe ECHO Application

The ECHO application server merely resends each line it The ECHO application server merely resends each line it receives from a client. The server is started (from a receives from a client. The server is started (from a command line) by typing the program name and a selected command line) by typing the program name and a selected application number (usually in the range 1025 to 32767).application number (usually in the range 1025 to 32767).

The client application is started by typing its name, the The client application is started by typing its name, the name of the computer on which the server is running, and name of the computer on which the server is running, and the same application number.the same application number.

Lines are then read by the client, echoed by the server, and Lines are then read by the client, echoed by the server, and displayed by the client, until an end of file (control-D on displayed by the client, until an end of file (control-D on UNIX, or control-Z on Windows) is entered.UNIX, or control-Z on Windows) is entered.

Illustration…Illustration…

Page 36: CSC383 Computer Networks

An Important ObservationAn Important Observation

If you examine the code for the echo client, you If you examine the code for the echo client, you will find that it does not immediately read will find that it does not immediately read another line from the keyboard after reading another line from the keyboard after reading data from the connection. This is because recv data from the connection. This is because recv only returns as much data as it has actually read.only returns as much data as it has actually read.

The reason for this is that the underlying The reason for this is that the underlying network may send a group of data bytes in network may send a group of data bytes in several different packets. Thus the received data several different packets. Thus the received data may arrive in pieces with sizes different from may arrive in pieces with sizes different from those used when the data was sent.those used when the data was sent.

Page 37: CSC383 Computer Networks

The CHAT ApplicationThe CHAT Application

The chat application is similar to the echo The chat application is similar to the echo application. Here, however, the server application. Here, however, the server displays the received data line and waits for a displays the received data line and waits for a response from the user on that machine, which response from the user on that machine, which is then sent back to the client for display.is then sent back to the client for display.

Either the user at the server machine or the Either the user at the server machine or the user at the client machine may terminate the user at the client machine may terminate the chat session by entering an end of file.chat session by entering an end of file.

Illustration…Illustration…

Page 38: CSC383 Computer Networks

The WEB ApplicationThe WEB Application

Our final example is a simple text-mode web server Our final example is a simple text-mode web server and browser. Only two web pages are provided by and browser. Only two web pages are provided by the server: “/” and “/time”. It is easy, however, to the server: “/” and “/time”. It is easy, however, to extend this application to deliver arbitrary pages extend this application to deliver arbitrary pages stored as files on the server machine.stored as files on the server machine.

The server and client both use the standard HTTP The server and client both use the standard HTTP protocol, and the server delivers HTML documents protocol, and the server delivers HTML documents with appropriate headers. Thus a commercial web with appropriate headers. Thus a commercial web browser could be used to contact our server.browser could be used to contact our server.

Illustration…Illustration…