I am trying to fully understand the TCP/UDP protocol before starting a network project.
Let's say I have a TCP Server. I understand that if I want someone to communicate with via Internet I need to open my listening port: the router/firewall let it pass and redirect it to me.
A TCP client is connecting to me, there is now a bound socket between the two systems. But how the server can send data to the client if this one have his port blocked:
The port is chosen dynamically, how the firewall/router know that it need to allow the data from my server, is it because I already send something to it and now knows that there is some kind of connection?
If yes, does it mean that for UDP both machines needs to unlock the port?