1

I know that TCP uses verification to ensure accuracy of data by sending to the server. My question is does it verify everything at once or as it comes in?


Quick Example:

Let's say I am loading the Superuser page here. For simplicity it can fit in 5 packets (virtually impossible to fit any modern webpage in such a small amount of data.):

All at once:

*Client: [Request data goes here]**

Server: [Packet 1]

Server: [Packet 2]

Server: [Packet 3]

Server: [Packet 4]

Server: [Packet 5]

Client: [Packet 1]

Client: [Packet 2]

Client: [Packet 3]

Client: [Packet 4]

Client: [Packet 5]


Bit by bit (sorry couldn't resist that pun!):

*Client: [Request data goes here]**

Server: [Packet 1]

Client: [Packet 1]

Server: [Packet 2]

Client: [Packet 2]

Server: [Packet 3]

Client: [Packet 3]

Server: [Packet 4]

Client: [Packet 4]

Server: [Packet 5]

Client: [Packet 5]

2
  • TCP uses cumulative ACK sending, i.e. for each few packets, an ACK is sent by client. Dec 24 '13 at 21:52
  • What do you mean by "verify"? TCP does not guarantee data integrity -- you need something like TLS for that. TCP does have a per-packet checksum, but that's not good for much except detecting line noise (assuming the lower protocol layers don't already do that). Dec 24 '13 at 21:52
2

From Tanenbaum's Computer Networks - 5th Edition:

The basic protocol used by TCP entities is the sliding window protocol with a dynamic window size. When a sender transmits a segment, it also starts a timer. When the segment arrives at the destination, the receiving TCP entity sends back a segment (with data if any exist, and otherwise without) bearing an acknowledgement number equal to the next sequence number it expects to receive and the remaining window size. If the sender’s timer goes off before the acknowledgement is received, the sender transmits the segment again.

Bold words clearly imply the second case, in which the packets are sent and acknowledgements are received in correct order. It's not the case that a bulk of packets are sent and their acknowledgements are waited for.

0

TCP uses sequence numbers in each packet to verify if all data which was sent is received and in proper order. Checksums are added to every packet to check if there's no corruption within the packet.

The TCP article on Wikipedia describes reliable transmission in more detail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.