免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1386 | 回复: 0
打印 上一主题 下一主题

Instruction of TCP [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-09-20 22:54 |只看该作者 |倒序浏览
TCP:Transmission Control Protocol
TCP provides a connection-oriented, reliable, byte stream service.
1:Connection-oriented means the two appliations using TCP must establish a TCP connection with eath other before they can exchange data.
2:Reliability:
(1):The application data is broken into what TCP consider the best sized chunks to send, the unit of information passed by TCP to IP is called a segment.
(2):When TCP sends a segment it maintains a timer, waiting for the other end to acknowledge reception of the segment. If an acknowledgment isn't received in time, the segment is retransmitted.
(3):When TCP receives data from the other end of the connection, it sends an acknowledgment. This acknowledgment is not sent immediately, but normally delayed a fraction of a second.
(4):TCP maintains a checksum on its header and data. This is an end-to-end checksum whose purpose is to detect any modification of the data in transit. If a segment arrives with an invalid checksum, TCP discards it and doesn't acknowledge receiving it. (It expects the sender to time out and retransmit.)
(5):Since TCP segments are transmitted as IP datagrams, and since IP datagrams can arrive out of order, TCP segments can arrive out of order. A receiving TCP resequences the data if necessary, passing the received data in the correct order to the application.
(6):Since IP datagrams can get duplicated, a receiving TCP must discard duplicate data.
(7):TCP also provides flow control. Each end of a TCP connection has a finite amount of buffer space. A receiving TCP only allows the other end to send as much data as the receiver has buffers for. This prevents a fast host from taking all the buffers on a slower host.
3:A stream of 8-bit bytes is exchanged across the TCP connection between the two applications. There are no record markers automatically inserted by TCP. This is what we called a byte stream service.
4:TCP does not interpret the contents of the bytes at all. 'TCP has no idea if the data bytes being exchanged are binary data, ASCII characters, EBCDIC characters, or whatever. The interpretation of this byte stream is up to the applications on each end of the connection.
TCP header encapsulated:
||
                ||
|   IP header   |    TCP header   |      TCP data        |
|   20 bytes    |     20 bytes    |                      |
TCP header:
|   16-bit Source port number    | 16-bit Destination port number|
|                     32-bit sequence number                     |
|                   32-bit acknowledge number                    |
|  4-bit | reserved |U|A|P|R|S|P|                                |
| header |   6bits  |R|C|S|S|Y|I|     16-bit window size         |
| length |(all zero)|G|K|H|T|N|N|                                |
|    16-bit TCP checksum        |    16-bit urgent pointer       |
|                           options(if any)                      |
|                               data                             |
URG:The urgent pointer is valid.  
ACK:The acknowledgment number is valid.  
PSH:The receiver should pass this data to the application as soon as possible.  
RST:Reset the connection.  
SYN:Synchronize sequence numbers to initiate a connection. This flag and the next are described in Chapter 18.  
FIN:The sender is finished sending data.  
# 2009-09-20 22:5
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/104229/showart_2056413.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP