I am trying to emulate artificial network conditions by delaying packets as necessary (application being emulated is a Java application).
The problem which I am facing is, the application detects that it has not received ACK for some time and re-transmits. This occurs at both ends causing a fission reaction. Packets are received out of order and eventually, one side sends an RST packet.
I want to make sure that this never happens. How should I avoid this?
Thanks
UPDATE: Some Wireshark capture session images: http://db.tt/fav2sRgL and http://db.tt/zGXwMubk
It sounds like you are holding packets for longer than 1 second, which is a really long time in network land and is not something TCP will be happy with. The failure cascade which results is pretty much what you should expect from TCP.
But first you need to consider whether that type of delay is really what you want to be emulating. There is a big difference between the time it takes a packet to traverse a path (one-way), the round-trip time (there and back), and the time it takes an application to process and respond (independent of the network stack).
I’ve written a couple of articles on network statistics and emulation which you may find useful.
Disclaimer: I work for a company which produces an alternative transport protocol.