Let's say we have the following TCP socket setup where client sends arbitary data to the server. Treat the following as a pseudocode.
def client():
while True:
data = source.get_data()
client_socket.send(data)
The server reads the data and uses it to do something...
def server():
while True:
data += socket.recv(4096)
parsed_data = parse_data(data)
cpu_intensive_task(parsed_data)
Let's assume that client will send the data much faster than the server can process. Can the internal network buffer fill up? I assume the answer is yes...
If so, then does the TCP protocol specify what will happend in this scenario? Are these discared packets treated as if they were lost in transit and just re-transmitted like any other lost packages?
Or are these packets truly lost and this something I have to consider when desiging my own communication protocol on top of the TCP?
Does the answer vary between operating systems?
For a record, the system above should have some kind of congestion control mechanism, which server could use to tell the client that it's under heavy load or it's free again. However, I'm curious to know how the TCP by the default would behave in this scenario.