Search code examples
socketsnetwork-programmingtcpudp

Does TCP congestion affect other ports?


I heard when TCP packet gets lost, everything gets stuck because of congestion until lost packet eventually gets received. e.g. server sends these packets on the same port:

1(UDP), 2(UDP), 3(TCP), 4(UDP), 5(UDP), 6(UDP)

so if packet 3 gets lost, client won't be able to receive 4, 5, 6, until packet 3 gets received, right?

If application uses two ports, one for TCP and other one for UDP, would TCP congestion affect UDP port performance? I mean would UDP packets get stuck?


Solution

  • TCP congestion should only affect the current connection (socket).

    In short, for each connection there is a TCP sliding window which is used to assemble the packets. If one packet gets lost, other packets on te same connection will be received and placed in the window, unless the the window is full.

    https://technet.microsoft.com/cc162519.fig02_L.gif
    (source: microsoft.com)

    So this should not affect other connections.

    See TCP window scale option, Congestion window and TCP Receive Window Auto-Tuning.