Presentations

18-UDP and TCP

Description
eddwe
Categories
Published
of 4
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  Operating Systems LectureNotes Lecture 18 UDP and TCP Martin C. Rinard ã IP delivers packets to machines. But, need higher level abstractions. UDP delivers  packets to ports on machines; TCP provides reliable, stream-based communication to a  port on a machine. ã hat is a port! It is an abstraction or a communication point. # process can read and $rite data to and rom a port. %ne machine can have multiple ports. Usuall&, dedicate  ports to di erent unctions. 'ave an tp port, a de ault telnet port, a mail port, etc. ã UDP message contains a header and data. UDP header contains( o )ource Port( port rom $hich message $as sent. o Dest Port( destination port on destination machine. o *ength( length o UDP packet. o UDP checksum( checksum. To send a UDP packet, encapsulate it in an IP packet, then send the IP packet to the appropriate machine. The $hole UDP packet is in the data area o the IP packet. ã The %) on the machine $ill receive the IP packet, reali+e that it contains a UDP packet, then pass the UDP packet on to the process $aiting or input on the destination UDP port.The %) reali+es that the IP packet contains a UDP packet b& looking at the protocol ield in the IP header. ã hen sending a UDP packet to a machine, $hat port should it be sent to! There are a set o $ell-kno$n ports that provide standard services available via UDP. ell-kno$n ports go rom  to , and onl& root processes can read or $rite rom ports $ith these numbers. #n e/ample( port 01 is the inger port. Port 21 is the Trivial 3ile Trans er Protocol 4T3TP5 port. B& convention, all machines use these port numbers or these services. ã T$o applications running on di erent machines can also agree to use their o$n port numbers or their o$n communication. T&picall&, %) d&namicall& allocates port numbers  on re6uest and the applications use those 4a ter setting up the port number communication via some other mechanism5. ã UDP does not provide reliable deliver&. Users must implement their o$n reliabilit&. There is a need or a reliable protocol. )o, have TCP. ã TCP provides abstraction o a reliable, t$o $a& data stream. It is la&ered on top o IP 7ustlike UDP, but is a heavier $eight protocol. ã Concept o a stream abstraction. # stream is 7ust a se6uence o characters. There are no  packet boundaries like there are $ith UDP and IP. The so t$are breaks the stream up into  packets, $ith the subdivision invisible to the application program. T&picall&, TCP connections bu er up more than one character be ore issuing an IP packet. But, can orcedata deliver& i $ant to. ã To get reliabilit& use a positive ackno$ledgement $ith timeout scheme. hen send something over a TCP connection, e/pect to get an #C8 back in a i/ed amount o time. I don9t get the #C8, assume data $as lost and retransmit. ã TCP optimi+es communication b& using a sliding $indo$. Instead o sending one IP  packet and $aiting or the #C8, it can have multiple outstanding un#C8ed packets. Basic idea is to ill the net$ork pipe bet$een sender and receiver $ith data. 8eep a stead& state $ith sender al$a&s sending and receiver al$a&s #C8ing. ã TCP also has port abstraction - a TCP connection goes bet$een t$o ports. To set up a TCP connection, use a three-$a& handshake. Initiator sends a re6uest, receiver sends an #C8, then sender sends back an #C8 to establish connection. ã Can close a TCP connection. ã Building services on top o TCP and UDP. T&picall&, use a client-server architecture. Basic idea( o )erver $aits at a $ell-kno$n port or client re6uests to come in. T&pical TCP server ports( : is Telnet,  is )TP 4)imple ail Transport Protocol5, < is 3TP. o Client allocates a local port number and sends it to server at $ell-kno$n port. )erver $ill communicate $ith client using the allocated local port number. o hen server gets re6uest, it allocates its o$n local port number and spa$ns a  process to provide service. The process connects up $ith client over the local  ports. o Client and spa$ned server process communicate over the established connection. ã #lmost all Internet services done this $a&. 3TP, telnet, etc. all $ork this $a&. an& services are 7ust character-oriented streams, and can interact $ith them at the terminal.  ã In general, la&er services on top o communications protocols. Can build arbitrar& la&ers. The packets or each service 7ust get encapsulated in the packets o lo$er-level services. =/ample rom snooped net$ork here at UC)B. )omeone is using >3) to look up a ile 4in this case a$k5. ã ETHER: ----- Ether Header ----- ã ETHER: ã ETHER: Packet 17 arrived at 9:44:30.37 ã ETHER: Packet size = 194 bytes ã ETHER: esti!atio! = :0:#0:1#:$e: d% &'! ã ETHER: &o'rce = :0:#0:1#:77:#a% &'! ã ETHER: Etherty(e = 0 00 )*P+ ã ETHER: ã *P: ----- *P Header ----- ã *P: ã *P: ,ersio! = 4 ã *P: Header e!th = #0 bytes ã *P: Ty(e o/ service = 000 ã *P: . .... = 0 )(recede!ce+ ã *P: ...0 .... = !ora deay ã *P: .... 0... = !ora thro'h('t ã *P: .... .0.. = !ora reiabiity ã *P: Tota e!th = 1 0 bytes ã *P: *de!ti/icatio! = 1$ ## ã *P: 2as = 04 ã *P: .1.. .... = do !ot /rae!t ã *P: ..0. .... = ast /rae!t ã *P: 2rae!t o//set = 0 bytes ã *P: Tie to ive = #4 seco!dsho(s ã *P: Protoco = 17 )5P+ ã *P: Header checks' = de e ã *P: &o'rce address = 1# .111.4#.1 % oo/y ã *P: esti!atio! address = 1# .111.49.3% coics ã *P: 6o o(tio!s ã *P: ã 5P: ----- 5P Header ----- ã 5P: ã 5P: &o'rce (ort = 10## ã 5P: esti!atio! (ort = #049 )&'! RP+ ã 5P: 8e!th = 1$0 ã 5P: hecks' = 094 ã 5P: ã RP: ----- &56 RP Header ----- ã RP: ã RP: Tra!sactio! id = #143#913 ã RP: Ty(e = 0 )a+ ã RP: RP versio! = # ã RP: Prora = 100003 )62&+% versio! = #% (roced're = 4 ã RP: rede!tias: 2avor = 1 )5!i+% e! = 7# bytes  ã RP: Tie = 0-'!-9 17:4:04 ã RP: Host!ae = oo/y ã RP: 5id = 0% ;id = 1 ã RP: ;ro'(s = 1 0 # 3 4  $ 7 9 1# ã RP: ,eri/ier : 2avor = 0 )6o!e+% e! = 0 bytes ã RP: ã 62&: ----- &'! 62& ----- ã 62&: ã 62&: Proc = 4 )8ook '( /ie !ae+ ã 62&: 2ie ha!de = 00 000040000000#000<0000000#2# ã 62&: 4$2<3#000<00000000000#$92<# ã 62&: 2ie !ae = ak ã 62&:
Search
Tags
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks
SAVE OUR EARTH

We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

More details...

Sign Now!

We are very appreciated for your Prompt Action!

x