Segmentation of TCP and UDP

I know that on a network, the data stream must be divided into different segments at level 4. Each segment is then encapsulated with a port number and IP address. I found some confusing questions that I would like to ask:

  • Who is responsible for dividing the data stream into different segments. Is this application or layer 4?

  • I realized that UDP does not support segmentation. So, how does the data stream flow into different segments for sending (as in a VoIP application)?

Thanks in advance

+4
source share
3 answers

A TCP connection is a stream of bytes. Packing is performed by the TCP / IP stack in the operating system.

UDP is not a stream - it's just a bunch of datagrams that are not guaranteed in any order (or at all). Any protocol implemented using UDP must process this data in its own way.

0
source

The application layer does not have to worry about segments (transport layer packets in TCP communications). Because it is created by the TCP layer. Theoretically, the segment size could be 65495. But it will be calculated based on the MTU of your outgoing interface, for example, an ethernet card. Thus, the application layer is not at all associated with the segmentation of the data stream. UDP is also at level 4, but it does not support reliability like TCP. Otherwise, the creation of a datagram (transport layer packets in UDP communications) is also exactly the same as segments in TCP.

0
source

Level 3 is responsible for data fragmentation. The typical MTU size is 576 bytes. Thus, the network layer splits the transport layer segment into pieces of 576 bytes, adds its own header and sends it to the data link layer.

Even with UDP fragmentation is possible. UDP does not know about fragmentation and reassembly of fragments, since it is the network layer that performs them. Everything that exceeds 576 bytes is fragmented regardless of the transport layer protocol.

In VoIP, data blocks (20-30 ms) are processed simultaneously and sent as an application layer message.

0
source

Source: https://habr.com/ru/post/1494190/


All Articles