Packet and Frames

Packets

Packets are small pieces of data sent over internet protocol.

Why are we using packets?

Because data is exchanged in small pieces, the large messages don’t bottleneck the network. When sending packets over TCP, if packets are lost on their way, the server will send those packets aging instead of the whole message.

Packet header

Packets sent over internet protocol (IP) have additional pieces of information called headers.

Notable headers: Time to Live - expiry timer for the packet to not clog up your network. Checksum - Integrity checking, if any data in changed then the pack is corrupted. Source Address

TCP/IP protocol

TCP/IP protocol contains four layer:

TCP is connection-based meaning it must establish a connection between both a client and a server before sending data. TCP guarantees that any data being sent will be received. This process is called Three-way handshake

explained in osi model

TCP packet headers:

UDP/IP protocol

UDP connection is stateless.

UDP packet header

Same as TCP but no Sequence Number, Acknowledgement number, Checksum or Flag.

Three-way handshake

SYN ACK DATA FIN RST

Frames

Frames are a little like packets, but they don’t have IP addressing information. Frames contain the data, and they are sent inside packets.