TcpCodec – a layer 4 codec
The layer 4 in the OSI model is also known as the transport layer. This layer deals with the establishment and maintenance of connections, flow control, and ensuring reliable communication. The layer 4 header will be found encapsulated within the Ipv4 (layer 3) datagram.
As we discussed in the previous section (in Figure 7.6), proto
within the Ipv4 header denotes the type of layer 4 protocol. There are several protocols that fall in this layer. Some of the common layer 4 protocols include TCP (protocol value 4
), UDP (protocol value 17
), and ICMP (protocol value 1
). The following table shows a subset of the IP values and the corresponding layer 4 protocol:
IP proto value |
Layer 4 protocol |
1 |
Internet Control Message Protocol (ICMP) |
2 |
Internet Group Management Protocol (IGMP... |