13: Transport Layer3a-16: Transport Layer OverviewLast Modified: 2/17/2003 2:18:41 PM3: Transport Layer3a-2Transport LayerOverview:❒ transport layer services❒ multiplexing/demultiplexing❒ connectionless transport: UDP❒ principles of reliable data transfer❒ connection-oriented transport: TCP❍ reliable transfer❍ flow control❍ connection management❍ congestion control❒Instantiation and implementation in the Internet3: Transport Layer3a-3Transport services and protocols❒ providelogical communicationbetween app’ processes running on different hosts❒ transport protocols run in end systems ❒ transport vs network layer services:❒network layer:data transfer between end systems❒transport layer:data transfer between processes❍ relies on, enhances, network layer services applicationtransportnetworkdata linkphysicalapplicationtransportnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicalnetworkdata linkphysicallogical end-end transport3: Transport Layer3a-4applicationtransportnetworkMP2applicationtransportnetworkProcess-to-Process Message DeliveryGoal : Deliver application data to correct process (and more particularly to the right socket)Segment - unit of data exchanged between transport layer entities; transport protocol data unit (TPDU)receiverHtHnsegmentsegmentMapplicationtransportnetworkP1MMMP3P4segmentheaderapplication-layerdata3: Transport Layer3a-5Transport protocol example❒ 2 households each with 12 children all cousins.❍ cousins all write letters to each other every week❍ In each house, one child volunteers to collect all the outgoing letters and distribute all the incoming letters❒Analogy to the Internet❍ Hosts = houses❍ Processes = cousins❍ Application messages = letters in envelopes❍ Network layer protocol = postal service❍ Transport layer protocol = volunteers• If note any missing letters and rerequest them etc. then like TCP• If just hand out whatever comes in then like UDP3: Transport Layer3a-6UDP: User Datagram Protocol [RFC 768]❒ “no frills,” “bare bones” Internet transport protocol❒ “best effort” service, UDP segments may be:❍ lost❍ delivered out of order to app❒connectionless:❍ no handshaking between UDP sender, receiver❍ each UDP segment handled independently of othersWhy is there a UDP?❒ no connection establishment (which can add delay)❒ TCP is based on a full duplex connection so can’t use to send to multiple receivers at once (I.e. broadcast or multicast)❒ simple: no connection state at sender, receiver❒ small segment header❒ no congestion control: UDP can blast away as fast as desired23: Transport Layer3a-7UDP: more❒ often used for streaming multimedia apps❍ loss tolerant❍ rate sensitive❍ Conducive to multicast❒ other UDP uses (why?):❍ DNS: small, retransmit if necessary❍ SNMP❒ reliable transfer over UDP: add reliability at application layer❍ application-specific error recover!source port # dest port #32 bitsApplicationdata (message; Ex. DNS Request format)UDP segment formatlengthchecksumLength, inbytes of UDPsegment,includingheader3: Transport Layer3a-8Multiplexing/demultiplexingDemultiplexing based on IP addresses and port number for both the sender and receiver ❍ Can distinguish traffic coming to same port but part of separate conversations (like multiple client connections to a web server)gathering data from multipleapplication processes on the same host and sending outthe same network interfacesource port # dest port #32 bitsapplicationdata (message)other header fieldsTCP/UDP segment formatMultiplexing:Stream of incoming data into one machine separated into smaller streams destined for individual processesDemultiplexing:3: Transport Layer3a-9Multiplexing/demultiplexing exampleTwo Web browsers on host Aeach open 1 socket Webserver BOne Web browser onhost C opens 2 socketsSource IP: CDest IP: Bsource port: ydest. port: 80Source IP: CDest IP: Bsource port: xdest. port: 80Source IP: ADest IP: Bsource port: xdest. port: 80<C,x> to<B,80><A,x> to<B,80><C,y> to<B,80>Source IP: ADest IP: Bsource port: tdest. port: 80<A,t> to<B,80>3: Transport Layer3a-10Port Implementation❒ Message queue❍ Append incoming message to the end❍ Much like a mailbox file❍ Choose which message queue based on <src ip+ port, dest ip +port>❒If queue full, ,message can be discarded❍ why is that ok? Best effort delivery❍ The network doesn’t guarantee not to drop, so the OS needn’t guarantee that either ❒When application, reads from socket, operating system removes some bytes from the head of the queue❒ If queue empty, application blocks waiting3: Transport Layer3a-11Demultiplexing❒ Packets arrive on network interface, copied up into system memory❒ Placed in message queue by transport protocol, dest IP and port number, src IP and port number ❒ Copied to user level when app reads socketDrop?Process A2 portsProcess B1 portUser levelKernel levelIncoming messages3: Transport Layer3a-12Demultiplexing (cont)❒ Receiving process may specify combinations of <srcaddr, srcport, destaddr, destport> it will receive or ANY❒ Demultiplexing by port numbers and IP address: other choices?❍ Ip address and process id? high overhead of coordination and couldn’t have multiple streams per process❍ Additional level of addressing by port number provides level of indirection and finer granularity addressing33: Transport Layer3a-13UDP Headers❒ Entire UDP header is 8 bytes❒ Source and destination ports for demultiplexing❒ Port field is 16 bits; so 216or 64K possible ports -not enough for whole Internet, why ok? Just for the single host!❒ Length is 16 bits❒ Checksum is 16 bitssource port # dest port #32 bitsApplicationdata (message)UDP segment formatlengthchecksumLength, inbytes of UDPsegment,includingheader3: Transport Layer3a-14UDP header field: checksumSender:❒ treat segment contents as sequence of 16-bit integers (add 0 pad to get even 16 bit chunks if necessary)❒ checksum: addition (1’s complement sum) of segment contents❒ sender puts checksum value into UDP checksum field❒ Checksum optional but should always be usedReceiver:❒ compute checksum of received segment❒ check if computed checksum equals checksum field value:❍ NO - error detected❍ YES - no error detected. But maybe errors nonethless?More later ….❍ Errors could be anywhere –in data, in headers, even in
View Full Document