#digipen/cs260 Entry Ticket
Differences between a packet and a segment.
In broad terms a segment is what the ransport layer deals with, if we are talking about software we would talk about the [[../02 Areas/Computer Science/Networking/TCP-IP Model|TCP PRotocol]]
Packet is about the [[../02 Areas/Computer Science/IPv4 Address|IP]] Protocol and is part of the network protocol.
Ideally we would want 1 segment to be equal to 1 packet,
Data -> Many Segments
Segment -> Many Packets
Flexibility for use cases, hardware, other limitations
Example: App to [[../02 Areas/Computer Science/Networking/TCP-IP Model|TCP]]
- Application: `send(s, some_mb_of_data);`
- TCP: split data into segments
- ~1460 bytes for [[Ethernet]]/[[../02 Areas/Computer Science/IPv4 Address|IPv4]]
- Each segmen get a TCP header
- Sequence number, etc
- Segments handled by TCP, Apps are ignorant of this
- But it can impact performance
- Programmers (you) must know about it :[
Example: TCP to IP
- TCP hands a segment to [[../02 Areas/Computer Science/IPv4 Address|IPv4]]
- Segments *arent* fragmented
- Segment (header+data) > [[../02 Areas/Computer Science/Maximum Transmission Unit|MTU]]
- IP splits into fragments
- *which is bad, we desire to avoid fragmentation*
Receiving IP to TCP to App
- Receiver gets IP. packet fragments
- Reassemble TCP segment
- TCP only sees whole segments
- TCP puts segments together into app data
- App only sees streaming data0
*Describe the 3-way handshake:*
- Client sends `SYN` with sequence number
- Server sends `SYN_ACK` with ack number, and its own sequence number
- Client sends `ACK` with correct sequence and aknowledgement numbers
- Now safe to send data