240-322 cli/serv.: netcon/61 client/server distributed systems v objectives –give some background...

49
0-322 Cli/Serv.: netCon/6 Client/Server Distributed Syste Client/Server Distributed Syste ms ms Objectives Objectives give some background in networking concepts give some background in networking concepts concentrate on the TCP/IP Protocol Suite in concentrate on the TCP/IP Protocol Suite in UNIX UNIX 240-322, Semester 1, 2005-2006 6. Networking Conce pts

Upload: brittany-sharp

Post on 05-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 1

Client/Server Distributed SystemsClient/Server Distributed Systems

ObjectivesObjectives– give some background in networking conceptsgive some background in networking concepts

– concentrate on the TCP/IP Protocol Suite in UNIXconcentrate on the TCP/IP Protocol Suite in UNIX

240-322, Semester 1, 2005-2006

6. Networking Concepts

Page 2: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 2

OverviewOverview

1. The Client-Server Model in UNIX1. The Client-Server Model in UNIX

2. Communication Protocols2. Communication Protocols

3. A Simplified OSI Model3. A Simplified OSI Model– based on TCP/IPbased on TCP/IP

4. Looking at Datagrams / the Network4. Looking at Datagrams / the Network

Page 3: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 3

1. The Client-Server Model in UNIX1. The Client-Server Model in UNIX

The server:The server:

– provides a service/resource to clientsprovides a service/resource to clients(e.g. database, printer)(e.g. database, printer)

– may be running anywhere on the networkmay be running anywhere on the network

– waits for a service request from a client waits for a service request from a client (or clients); it is (or clients); it is passivepassive

– often started at system boot-upoften started at system boot-up

continued

Page 4: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 4

The client:The client:

– starts the communication with a server; starts the communication with a server; it is it is activeactive

– needs to know the server’s ‘address’needs to know the server’s ‘address’

– may be running anywhere on the networkmay be running anywhere on the network

Page 5: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 5

1.1. System Services1.1. System Services

daemonsdaemons

– UNIX system-related services that are UNIX system-related services that are always availablealways available

– their names often end with ‘their names often end with ‘dd’’ e.g. e.g. rlogindrlogind, , ftpdftpd, , sendmailsendmail

– many are started at system boot-up by many are started at system boot-up by a ‘super server’, a ‘super server’, inetdinetd

Page 6: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 6

1.2. Locating a Server1.2. Locating a Server

A server’s address is in two parts:A server’s address is in two parts:

– the IP (Internet Protocol) address; a 32-bit integer. Written the IP (Internet Protocol) address; a 32-bit integer. Written in in dotted-decimal formdotted-decimal form::

172.30.0.5172.30.0.5

– a port number; a 16-bit integera port number; a 16-bit integer the server ‘listens’ for client requests on the server ‘listens’ for client requests on

that portthat port

Page 7: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 7

IP AddressesIP Addresses

IP addresses can also be written in IP addresses can also be written in dotted-namedotted-name form: form:– e.g. e.g. fivedotsfivedots

fivedots.coe.psu.ac.thfivedots.coe.psu.ac.th

Most network functions require the Most network functions require the dotted-decimal form as input.dotted-decimal form as input.

Page 8: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 8

Converting to dotted-decimalConverting to dotted-decimal

#include <netdb.h>#include <netdb.h>struct hostent struct hostent

*gethostbyname(char *hostname);*gethostbyname(char *hostname);

Returns a struct containing the dotted-decimal Returns a struct containing the dotted-decimal IP address (and other things) corresponding to IP address (and other things) corresponding to the host namethe host name– more details latermore details later

Page 9: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 9

Internet Name ServersInternet Name Servers

gethostbyname()gethostbyname() obtains its info. from:obtains its info. from:

– host details in host details in /etc/hosts/etc/hosts

– by sending queries to a name server (by sending queries to a name server (namednamed) ) on another machine. Its address is usually on another machine. Its address is usually found in found in /etc/resolv.conf/etc/resolv.conf

Page 10: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 10

Port NumbersPort Numbers

The standard UNIX servers have fixed port The standard UNIX servers have fixed port numbers (reserved) between 1 and 1023.numbers (reserved) between 1 and 1023.

– ftpdftpd listens at port 21 listens at port 21– mailmail at port 25 at port 25– web servers at port 80web servers at port 80

Service details are stored in Service details are stored in /etc/services/etc/services

Page 11: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 11

Obtaining a Port NumberObtaining a Port Number

#include <netdb.h>#include <netdb.h>struct servent struct servent

*getservbyname(char *servname, *getservbyname(char *servname, char *protoname); char *protoname);

The service name is looked up in The service name is looked up in /etc/services/etc/services, and a struct is returned , and a struct is returned containing the port number (and other things)containing the port number (and other things)– more details latermore details later

Page 12: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 12

1.3. Network Byte Order1.3. Network Byte Order

A 16-bit integer requires two bytes of A 16-bit integer requires two bytes of storage; a 32-bit integer requires four bytes.storage; a 32-bit integer requires four bytes.

How is the integer split across the bytes?How is the integer split across the bytes?– little endian byte orderlittle endian byte order

e.g. PCs (Intel 80x86, etc), DECse.g. PCs (Intel 80x86, etc), DECs– big endian byte orderbig endian byte order

e.g. Macs (Motorola 68000, etc), IBMse.g. Macs (Motorola 68000, etc), IBMs

Page 13: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 13

Little Endian Byte OrderLittle Endian Byte Order

For a 16-bit integer (2 bytes), such as For a 16-bit integer (2 bytes), such as B34DB34D::

memoryaddress

A

A+1

low-order byte4D

B3 high-order byte

Page 14: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 14

Big Endian Byte OrderBig Endian Byte Order

For a 16-bit integer (2 bytes), such as For a 16-bit integer (2 bytes), such as B34DB34D::

memoryaddress

A

A+1 low-order byte4D

B3 high-order byte

Page 15: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 15

StandardisingStandardising

Most network protocols (e.g. TCP/IP) use Most network protocols (e.g. TCP/IP) use big-endian format for integers.big-endian format for integers.

We must convert all integers (e.g. port numbers, We must convert all integers (e.g. port numbers, dotted-decimal addresses) to big endian format dotted-decimal addresses) to big endian format before using thembefore using them– usually called usually called network byte ordernetwork byte order

Page 16: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 16

Converting to big endianConverting to big endian

#include <sys/types.h>#include <sys/types.h>#include <netinet/in.h>#include <netinet/in.h>

u_long htonl(u_long hostlong);u_long htonl(u_long hostlong);u_short htons(u_short hostshort);u_short htons(u_short hostshort);

Converts the host machine format to Converts the host machine format to network byte format (big endian):network byte format (big endian):

u_short = 16 bits, u_long = 32 bitsu_short = 16 bits, u_long = 32 bits

Page 17: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 17

2. Communication Protocols2. Communication Protocols

How does a client send a request to a server?How does a client send a request to a server?

AnswerAnswer: use a communication protocol : use a communication protocol (a set of network commands) understood by (a set of network commands) understood by the network and the server.the network and the server.

continued

Page 18: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 18

Application protocols (e.g. Application protocols (e.g. ftpftp, the Web) , the Web) are implemented on top of lower-level are implemented on top of lower-level protocols (e.g. TCP, UDP).protocols (e.g. TCP, UDP).

The protocol levels are specified in the The protocol levels are specified in the ISO OSI modelISO OSI model– ISO = International Standards OrganizationISO = International Standards Organization– OSI = Open Systems InterconnectionOSI = Open Systems Interconnection

Page 19: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 19

ISO OSI ModelISO OSI Model

7

6

5

4

3

2

1

high-levelprotocol

low-levelprotocol

Application

Presentation

Session

Transport

Network

Data Link

Physical

Page 20: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 20

Protocol SuitesProtocol Suites

A collection of related protocols for using A collection of related protocols for using the layers of the OSI model.the layers of the OSI model.

There are many different suites:There are many different suites:– TCP/IPTCP/IP– UUCPUUCP– XNS (Xerox Network Systems)XNS (Xerox Network Systems)– NetBIOS (IBM)NetBIOS (IBM)

Page 21: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 21

TCP/IPTCP/IP

The DARPA Internet Protocol Suite:The DARPA Internet Protocol Suite:

– DARPA is the research part of the US DARPA is the research part of the US Dept. of DefenseDept. of Defense

– first used in 1981 across 13 sites, first used in 1981 across 13 sites, linked by phone lines; developed into linked by phone lines; developed into the Internetthe Internet

– included in BSD UNIX in 1982included in BSD UNIX in 1982

Page 22: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 22

TCP/IP FeaturesTCP/IP Features

Implemented on everythingImplemented on everything– PCs to supercomputersPCs to supercomputers

Not vendor-specificNot vendor-specific

Suitable for LANs and WANsSuitable for LANs and WANs– scaleablescaleable

Page 23: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 23

3. A Simplified OSI Model 3. A Simplified OSI Model

Discussed by Berson, section 5.4 pp.142-146Discussed by Berson, section 5.4 pp.142-146– simplified by me!simplified by me!– read the full versionread the full version

A simplification of the OSI model to four A simplification of the OSI model to four layers, and using the TCP/IP protocol suite layers, and using the TCP/IP protocol suite and ethernet hardware.and ethernet hardware.

Page 24: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 24

Communication between 2 SystemsCommunication between 2 Systems

Applicatione.g. FTP client

Transporte.g. TCP

Networke.g. IP

Data Linke.g. ethernet controller

The physical network

Applicatione.g. FTP server

Transporte.g. TCP

Networke.g. IP

Data Linke.g. ethernet controller

FTP protocol

TCP protocol

IP protocol

ethernet frames

Page 25: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 25

3.1. Data Formatting3.1. Data Formatting

At a particular layer, the data appears to At a particular layer, the data appears to cross by the dotted linecross by the dotted line– e.g. to the user, the FTP protocol does the worke.g. to the user, the FTP protocol does the work

In fact, data is passed In fact, data is passed downdown through the through the layers, layers, acrossacross the physical network, back the physical network, back upup through the layers of the other system.through the layers of the other system.

continued

Page 26: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 26

As each layer is descended, the user’s As each layer is descended, the user’s data is wrapped inside more header (and data is wrapped inside more header (and footer) information.footer) information.

The headers (and footers) are removed as The headers (and footers) are removed as the data rises through the layers on the the data rises through the layers on the other system.other system.

Page 27: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 27

Data EncapsulationData Encapsulation

Application data

Application dataTCP header

Application dataTCP headerIP header

Application dataTCP headerIP headerethernet header

transport layer

network layer

application layer

data link layer

Page 28: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 28

3.2. Data Link Layer3.2. Data Link Layer

Corresponds to the OSI physical and data Corresponds to the OSI physical and data layers.layers.

Delivers Delivers framesframes between two directly between two directly connected machines.connected machines.

Network implementations: ethernet, token Network implementations: ethernet, token ring, Appletalk, etc.ring, Appletalk, etc.

Page 29: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 29

Simplified Ethernet Frame Simplified Ethernet Frame FormatFormat

Preamble(64 bits)

Destinationaddress(48 bits)

Sourceaddress(48 bits)

Packet type(16 bits)

Data (368-12,000 bits)

CRC(32 bits)

e.g. IP Datagram

Page 30: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 30

3.3. The Network Layer3.3. The Network Layer

Delivers Delivers datagramsdatagrams between any two machines between any two machines on the Interneton the Internet– the IP protocol uses IP addressesthe IP protocol uses IP addresses

Machines may be separated by intervening Machines may be separated by intervening gateways/routers.gateways/routers.

User data may need to be split into several User data may need to be split into several datagrams due to size limits.datagrams due to size limits.

Page 31: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 31

IssuesIssues

Each datagram is routed independently:Each datagram is routed independently:

– two datagrams sent from the same source may two datagrams sent from the same source may travel along travel along different pathsdifferent paths

– they may arrive in a they may arrive in a different orderdifferent order from the from the way they were sentway they were sent

continued

Page 32: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 32

A gateway/router has limited memory:A gateway/router has limited memory:

– it may discard datagrams if too many arrive at it may discard datagrams if too many arrive at onceonce

– no guarantee that a datagram will arrive at its no guarantee that a datagram will arrive at its destinationdestination

Page 33: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 33

Simplified IP Datagram FormatSimplified IP Datagram Format

length

fragmentationinformation

TimeTo Live

Transportprotocolfor data

Headerchecksum

SourceIP addr(32 bits).

DestinationIP address(32 bits)

Options

Datae.g. TCPdatagram

version

Page 34: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 34

Fuller InformationFuller Information

The previous slide is based on IPv4 which is The previous slide is based on IPv4 which is starting to be replaced by IPv6:starting to be replaced by IPv6:– key differences: 128-bit addresses, a simpler key differences: 128-bit addresses, a simpler

header, multicasting, authentication, securityheader, multicasting, authentication, security

A good overview can be found in:A good overview can be found in:– Appendix AAppendix A

UNIX Network ProgrammingUNIX Network Programming, Vol. 1, Vol. 1W. Richard StevensW. Richard Stevens

Page 35: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 35

3.4. The Transport Layer3.4. The Transport Layer

Delivers datagrams between transport Delivers datagrams between transport end-points (e.g. machine ports) for any end-points (e.g. machine ports) for any two machines on the Internet.two machines on the Internet.

TCP/IP transport layer protocols:TCP/IP transport layer protocols:– UDPUDP: User Datagram Protocol: User Datagram Protocol– TCPTCP: Transmission Control Protocol: Transmission Control Protocol

Page 36: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 36

3.4.1. UDP3.4.1. UDP

A connectionless transport service:A connectionless transport service:

– a user message is split into datagrams and a user message is split into datagrams and sent in partssent in parts

– there is no (expensive) long-term, dedicated there is no (expensive) long-term, dedicated link needed between the two systemslink needed between the two systems

continued

Page 37: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 37

Like the Postal Service:Like the Postal Service:

– UDP datagrams may arrive in any orderUDP datagrams may arrive in any order

– no guarantee that a UDP datagram will arriveno guarantee that a UDP datagram will arrive

– very close (in functionality) to IP layer datagramsvery close (in functionality) to IP layer datagrams

Page 38: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 38

Simplified UDP Datagram FormatSimplified UDP Datagram Format

Sourceport no.

Dest.port no.

Lengthof data

ChecksumData forthe application

Page 39: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 39

3.4.2. TCP3.4.2. TCP

A connection-oriented transport service.A connection-oriented transport service.

Client-server communication can be viewed Client-server communication can be viewed as a long-term, dedicated link between as a long-term, dedicated link between them.them.– like the telephone service like the telephone service – two-way communication is possibletwo-way communication is possible

continued

Page 40: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 40

The ‘dedicated’ link is implemented with The ‘dedicated’ link is implemented with datagrams, but TCP guarantees that:datagrams, but TCP guarantees that:

– TCP datagrams arrive in the order they were TCP datagrams arrive in the order they were sentsent

– all TCP datagrams will arrive (none are lost)all TCP datagrams will arrive (none are lost)

Page 41: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 41

TCP ImplementationTCP Implementation

How is reliability and correct ordering How is reliability and correct ordering implemented by TCP on top of the IP layer?implemented by TCP on top of the IP layer?

continued

Page 42: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 42

By using a technique called By using a technique called positive positive acknowledgement and retransmissionacknowledgement and retransmission::– each datagram is numberedeach datagram is numbered

– the TCP layer in the server sends back a numbered the TCP layer in the server sends back a numbered acknowledgement when it gets a datagramacknowledgement when it gets a datagram

– the TCP layer in the client resends a datagram after the TCP layer in the client resends a datagram after a certain time if there is no acknowledgementa certain time if there is no acknowledgement

Page 43: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 43

DiagramDiagram (Brown, p.174) (Brown, p.174)

Eventsat sender

Eventsat receiver

datagram 1ack 1

datagram 2

datagram 2resent

ack 2Datagram lost

Page 44: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 44

Improving the SpeedImproving the Speed

The diagram suggests that the sender must The diagram suggests that the sender must wait for datagram 1 to be acknowledged wait for datagram 1 to be acknowledged before datagram 2 is sent:before datagram 2 is sent:– slow and unnecessaryslow and unnecessary

– can send several packets can send several packets (up to a limit set by the receiver)(up to a limit set by the receiver)

– use the use the sliding window protocolsliding window protocol

Page 45: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 45

Sliding Window ProtocolSliding Window Protocol Brown Brown p.175p.175

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 . . . .

Bytestream

window size

Bytes already sent to receiver

Bytes acknowledged

Bytes not sent yet

Bytes not acknowledged yet

Page 46: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 46

NotesNotes

This mechanism is hidden inside the This mechanism is hidden inside the implementation of the TCP layer.implementation of the TCP layer.– the user only needs to know the interface the user only needs to know the interface

functionsfunctions

The IP layer can (and does) support other The IP layer can (and does) support other transport protocols apart from TCP and transport protocols apart from TCP and UDP.UDP.

Page 47: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 47

Simplified TCP Datagram FormatSimplified TCP Datagram Format

Sourceport no

Dest.port no

Sequencenumber

Ack. number

Flags

Windowsize

Checksum

Urgentpointer

Options Data

Page 48: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 48

4. Looking at Datagrams / the Network4. Looking at Datagrams / the Network

tcpdumptcpdump: examine datagram headers: examine datagram headers– e.g.e.g. tcpdump host fivedots port 80tcpdump host fivedots port 80

look at Web server headerslook at Web server headers

netstat -anetstat -a

– lists all transport end-points (ports)lists all transport end-points (ports)

snoopsnoop (in Solaris 2.1) (in Solaris 2.1)– see “see “man snoopman snoop” and Brown, p.177, 179” and Brown, p.177, 179

Page 49: 240-322 Cli/Serv.: netCon/61 Client/Server Distributed Systems v Objectives –give some background in networking concepts –concentrate on the TCP/IP Protocol

240-322 Cli/Serv.: netCon/6 49

There are many similar tools for WindowsThere are many similar tools for Windows– search for "packet sniffer" or "network monitorisearch for "packet sniffer" or "network monitori

ng" in Googleng" in Google– many shareware products at places like many shareware products at places like http:/http://www.tucows.com/www.tucows.com