Skip to content

Commit d93918d

Browse files
committed
Add Transmission control protocol (TCP) section
1 parent 297af21 commit d93918d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,3 +1472,27 @@ HTTP is an application layer protocol relying on lower-level protocols such as *
14721472

14731473
* [HTTP](https://www.nginx.com/resources/glossary/http/)
14741474
* [README](https://www.quora.com/What-is-the-difference-between-HTTP-protocol-and-TCP-protocol)
1475+
1476+
### Transmission control protocol (TCP)
1477+
1478+
<p align="center">
1479+
<img src="http://i.imgur.com/JdAsdvG.jpg">
1480+
<br/>
1481+
<i><a href=http://www.wildbunny.co.uk/blog/2012/10/09/how-to-make-a-multi-player-game-part-1/>Source: How to make a multiplayer game</a></i>
1482+
</p>
1483+
1484+
TCP is a connection-oriented protocol over an [IP network](https://en.wikipedia.org/wiki/Internet_Protocol). Connection is established and terminated using a [handshake](https://en.wikipedia.org/wiki/Handshaking). All packets sent are guaranteed to reach the destination in the original order and without corruption through:
1485+
1486+
* Sequence numbers and [checksum fields](https://en.wikipedia.org/wiki/Transmission_Control_Protocol#Checksum_computation) for each packet
1487+
* [Acknowledgement](https://en.wikipedia.org/wiki/Acknowledgement_(data_networks)) packets and automatic retransmission
1488+
1489+
If the sender does not receive a correct response, it will resend the packets. If there are multiple timeouts, the connection is dropped. TCP also implements [flow control](https://en.wikipedia.org/wiki/Flow_control_(data)) and [congestion control](https://en.wikipedia.org/wiki/Network_congestion#Congestion_control). These guarantees cause delays and generally results in less efficient transmission than UDP.
1490+
1491+
To ensure high throughput, web servers can keep a large number of TCP connections open, resulting in high memory usage. It can be expensive to have a large number of open connections between web server threads and say, a [memcached](#memcached) server. [Connection pooling](https://en.wikipedia.org/wiki/Connection_pool) can help in addition to switching to UDP where applicable.
1492+
1493+
TCP is useful for applications that require high reliability but are less time critical. Some examples include web servers, database info, SMTP, FTP, and SSH.
1494+
1495+
Use TCP over UDP when:
1496+
1497+
* You need all of the data to arrive in tact
1498+
* You want to automatically make a best estimate use of the network throughput

0 commit comments

Comments
 (0)