之前做的presentation.
- what happened when you hit google.com in the Chrome behind the scene.
Well, something happended, because today we are talking about tcp/ip protocol,so I just describe the stuff related to them, because other things I also don’t know,haha.


2.Okay,when you hit google.com, the google.com is user data, which will be packaged to application data by Chrome app(Application Layer), then add tcp header on Transport Layer, then add ip header on Network Layer, then add ethernet header on Data Link Layer.On server side, there also have 4 layers like the app’s side, they will unpackage the corresponding data and let the server know what client want.
Now in our company,We build website,mobile app, etc. All stuff we did are on Application Layer,we work on it.Last time bertrand talked about the http2,its an application layer protocol,which close to us,maybe you will meet it in your next project.Today I won’t talk about it,we will talk about other 3 layers and start from Transport Layer.

3.On transport layer,there are two main protocols,UDP and TCP.

This is TCP header looks like,TCP provides a reliable,connection-oriented,byte stream service.From the header,you can see there are many fields.Because the service is reliable,so it need some mechanisms to guarantee it.I believe some of you already heard about the three-way handshake, which is tcp connection establishment process.

Now i want to talk a little bit about it,how the three-way handshake works.When you want to build a connection between the client and server,you need to send a SYN msg to server,when server receive the SYN msg from client,it will return a SYN msg, which like the client’s SYN msg,and ACK msg for client’s SYN,which will tell client that the server have already received your msg.Finally,the client get the server’s SYN and ACK,client check the ACK correctness, if its right, the client side conncetion is established,then send ACK back to the server.The server side will be established when the ACK is checked and received.When both sides connection are established,the data transfer can start.

This is UDP header,it just have 5 fields, source port, destination port, these two use for process communication,checksum use for error check.Data is the data we send.UDP is a simple,datagram-oriented protocal, which provides no reliability.Because it just send data,don’t care about if the data reach the destination.
maybe you are very curious,why we need udp,its unreliable.The thing is udp has something tcp doesn’t have,think about video on website,so many many people see one video,the server can send the same video to a lot of different location,if the data lost,the video will not very clear,just this,no big deal,you still can see the video.tcp can’t do like this,its point to point connection,one connection can use by two points.

On Network Layer,the most import protocol is IP, Internet Protocol.What we need to know in this presentation is that there are source IP address and destination IP address.With this thing,the data know where they should go.

On this layer, all data from upper layer will be converted into frame,then they can be delivered on cable.This is one funtion of data link layer,this layer also can control the sender flow,because sometimes the receiver’s network is not good,so they can’t resolve all the data from the sender,so the sender need to wait receiver to process the data which are already sent.One more important function is error control,the data can’t be transfered 100% correct on cable,so on data link layer there is a method to check these stuff to make sure data already is sent to where they should go.
references:
1.tcp header detail: http://www.tcpipguide.com/free/t_TCPMessageSegmentFormat-3.htm
2.udp header detail: http://www.tcpipguide.com/free/t_UDPMessageFormat.htm
3.ip header detail: http://www.tcpipguide.com/free/t_IPDatagramGeneralFormat.htm
4.three-way handshake: http://www.tcpipguide.com/free/t_TCPConnectionEstablishmentProcessTheThreeWayHandsh-3.htm
5.tcp connection ternination: http://www.tcpipguide.com/free/t_TCPConnectionTermination-2.htm





近期评论