'Old-duplicate data packets in TFTP protocol

I found this question in Book called An Introduction to Computer Networks by Peter L Dordal, and I met with this question which I found it a little bit tricky:

In the TFTP protocol:

If the client changes its port number on a subsequent connection, but the server does not, what prevents an old-duplicate data packet sent by the server from being accepted by the new client?

If the server changes its port number on a subsequent connection, but the client does not, what prevents an old-duplicate data packet sent by the server from being accepted by the new client?

http://intronetworks.cs.luc.edu/current/html/udp.html?highlight=cumulative#old-duplicate



Solution 1:[1]

TFTP shouldn't be used when the connection is not near-perfect (=local, few hops). UDP isn't reliable by itself and TFTP doesn't do enough to improve on that very much.

However, the example is somewhat hypothetical. Both client and server are likely to use ephemeral ports chosen by the OS. The time window for the duplicate packet to match is very small - the queue flush time of a router in between - and the ephemeral port numbers would need to wrap around on both sides simultaneously.

That said, TFTP should only be used on short connections where security doesn't matter - if at all. There are more modern alternatives for reliable and secure file transfer.

Solution 2:[2]

The two questions have a similar response. The reason is that, in the first question, the returning duplicate packets were using the old client port number which has changed. Therefore the packets could not be delivered to the client.

On the other hand, where the client is still using the old port number, data will not be sent if a different protocol is used or the client moved to use a different IP address.

I hope this clears your doubts a little.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zac67
Solution 2