TCP vs UDP
2014-04-26 22:25
246 查看
TCP:Transmission Control Protocol
TCP is a network transport Internet Protocol typically used for its bidirectional communications reliability.
TCP is a protocol which
first establishes a connection
and then transmits data over that connection.
Replies of acknowledgement are sent to each end of the connection to communicate the fact that the transmitted data was valid to determine if the data should be re-sent.
The TCP header is
24 bytes of information including the source and destination port, the packet sequence information, checksum and various flags indicating the purpose of the packet.
TCP is a
streaming protocol where a numbered set of packets are sent over the network and available to the system in-order.
This makes TCP appropriate for file transfer and web content delivery.
UDP:User Datagram Protocol
UDP is a protocol which supports a single packet of data with no response, verification or acknowledgement.
A checksum is included in the UDP packet header but the protocol does not arrange for retransmission upon error.
It is a faster communications method as it does not require the overhead of a connection, reliability or packet order.
Each packet is
independent of the other and typically used for data no larger than the maximum UDP packet size of 64 Kb (65507 bytes) for the 8 byte header and data, but typically much smaller.
IPv4 Packet Headers:
Flags:
SYN: signifies first packet sent when opening a connection
ACK: After SYN packet is sent, ACK is set to 1
RST: Request to reset the connection
FIN: Last packet - transmission done
TCP is a network transport Internet Protocol typically used for its bidirectional communications reliability.
TCP is a protocol which
first establishes a connection
and then transmits data over that connection.
Replies of acknowledgement are sent to each end of the connection to communicate the fact that the transmitted data was valid to determine if the data should be re-sent.
The TCP header is
24 bytes of information including the source and destination port, the packet sequence information, checksum and various flags indicating the purpose of the packet.
TCP is a
streaming protocol where a numbered set of packets are sent over the network and available to the system in-order.
This makes TCP appropriate for file transfer and web content delivery.
UDP:User Datagram Protocol
UDP is a protocol which supports a single packet of data with no response, verification or acknowledgement.
A checksum is included in the UDP packet header but the protocol does not arrange for retransmission upon error.
It is a faster communications method as it does not require the overhead of a connection, reliability or packet order.
Each packet is
independent of the other and typically used for data no larger than the maximum UDP packet size of 64 Kb (65507 bytes) for the 8 byte header and data, but typically much smaller.
IPv4 Packet Headers:
TCP:
Source Port 16 bits (0 - 65535) | Destination Port 16 bits (0 - 65535) | ||||||||||
Sequence Number 32 bits (0 - 4294967295) Increments from 1, zero to clear. | |||||||||||
Acknowledgement Number 32 bits (0 - 4294967295) | |||||||||||
Data Offset | Res | N S | C W R | E C E | U R G | A C K | P S H | R S T | S Y N | F I N | Window 16 bits |
Checksum 16 bits | Urgent Pointer (If URG is set) 16 bits | ||||||||||
Options | Padding |
SYN: signifies first packet sent when opening a connection
ACK: After SYN packet is sent, ACK is set to 1
RST: Request to reset the connection
FIN: Last packet - transmission done
UDP:
Source Port 16 bits (0 - 65535) | Destination Port 16 bits (0 - 65535) |
Length (entire datagram: header and data) 16 bits (8 - 65535) | Checksum (If not used - all zeros) 16 bits |
相关文章推荐
- 一个UDP实现广播的小例子
- UDP协议的两个主要方法sendto和recvfrom详解
- UDP
- Udp通讯实例
- udp传送文件
- NAT(network address translation) tcp udp 打洞
- Java UDP聊天程序
- UDP数据包大小问题
- UDP的组播简单实现
- UDP
- Python的Socket模块TCP UDP简单使用
- TcpUdp与Socket的学习(2)
- 网络入侵检测与UDP包捕
- RUDP之一 —— UDP VS TCP
- 基于Socket的UDP和TCP编程介绍
- [p2p]UDP用打洞技术穿透NAT的原理与实现(附源代码 转)
- NAT的完全分析及其UDP穿透的完全解决方案
- java网络编程之UDP
- winsock 的udp
- Python实现简单的udp打洞(P2P)