Y
Y
Yu Yu2015-06-16 22:07:37
Programming
Yu Yu, 2015-06-16 22:07:37

What information is sent in a TCP packet?

I am sending a parcel of ten bytes. The problem is catching them all at the other end. The partner can only process a certain number of bytes, otherwise the buffer is shifted.
TCP protocol question.
Does the packet being sent contain information about the number of bytes sent?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
J
jcmvbkbc, 2015-06-16
@jcmvbkbc

Does the packet being sent contain information about the number of bytes sent?

About the number of bytes you sent , no. The number of bytes sent by the TCP stack is indicated in the IP header. If you need framing within a TCP stream, you can organize it yourself.

T
throughtheether, 2015-06-16
@throughtheether

Does the packet being sent contain information about the number of bytes sent?
If there is a TCP segment encapsulated in an IP packet, then the TCP payload length can be found as follows - from the IP payload length (calculated as the difference between the total IP packet length, Total Length, and the header length, Internet Header Length) we subtract TCP header length (Data Offset field).
If the task is different - to find out how many bytes were sent, then this information (the number of bytes transferred), as far as I remember, is returned by the send / write call.

Y
Yu Yu, 2015-06-16
@xztau

Recommend a book that understands the protocols TCP UDP IP over Ethernet from the bottom. I will be glad if in Russian.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question