Today, I learned about the TCP.
These are the features of TCP.
- Point-to Point (not Bcast)
- Single sender, single receiver.
- Routers don't know TCP con.
- Reliable, in-order byte stream
- no "message boundaries"
- Pipelined
- TCP congestion and flow control set window size
- TCP connection state
- Send and receive buffer
- Congestion ctrl parameters
- Sequence number, ACK number for reliability
- Full duplex data
- Bi-directional data flow in same connection
- Connection-oriented
- Handshaking (exchange of control messages) inits sender, receiver state before data exchange
- Flow controlled
- Sender will not overwhelm receiver
This is the segment structure of TCP:
TCP connection Management
Before exchanging data, sender/receiver "handshake"
- Agree to establish connection (each knowing the other wiling to establish connection)
- Atree on connection parameters
In TCP 3-way handshake, the connection begins by sending SYN msg to server like this.
Socket is like the door. When client estabish by sending SYN to server, and server response with SYNACK.
Now, we are gonna see how closing the connection between client and server.
Depending on the application, there are two way to close the connection. Client sends the FIN message first,
or Server sends the FIN message first.
In TCP, there is a "Processes communicating."
Process: running within a host.
- Within same host, two processes communicate using inter-process communication
- Between two different hosts, two processes communicate by exchanging messages
- Client Process: process that initiates communication
- Server Process: process that waits to be contacted
- Application with P2P architectures have client processes & server processes
I would like to more talkb about the Sockets.
Sockets
- Process sends/receives messages to/from its socket
- Socket analogous to door
- Sending process shoves message out door
- Sending process relies on transport infrastructure on other side of door to deliever message to socket at receiving process
This picture explains about the buffer between server and client.
Lastly, we are gonna talk about the TCP sequence numbers and acknowlegements.
- Sequence numbers:
- byte stream "number" of first byte in segment's data
- Acknowledgements:
- Sequence number of next byte expected from other side
- Cumulative ACK (all segments must be in order)
So, here is the question: how receiver handles out-of-order segments
The answer is TCP spec doesn't say, up to impementer. Might be discarded or kept untill the gap can be filled by arriving segments. Here we assume out-of-order segments are discarded.
We can see how acknowledge reacts to the sequence numbers.
In the second picture, if we miss some packets, acknowledge is still 100.
In the third picture, now the next acknowledge is 180 to fill out the miss packets.
'Computer Science π > Network Programming π°οΈ' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
MAC protocol (1) (0) | 2023.05.04 |
---|---|
TCP (2) (0) | 2023.05.02 |
UDP (0) | 2023.04.27 |
Data Center Network (0) | 2023.04.27 |
A day in life network (0) | 2023.04.27 |