Delay a tcp stream

0

I need to synchronize two different streams of data. I'll call them strem A and B in the following. At time zero, both streams start from the sender. But stream A suffer a delay at the beginning of transmission (in the range 1s to 10sec) with respect to stream B. At the receiver, I need to synchronize the streams, so what I need is a (python, C, C++, Java), program that open the socket to receive B (to a given IP:port) buffer the data for (example. 10sec), and then start to: 1) read the data from B and copy them in a queue. 2) read data from the front of the queue and send them to another ip:port. In this way, in the latter port I can read them, synchronized with A. I don't know if netcat, or other tools can do this with some options, or if there are already programs (under Windows 10) that can be used to do this. Eventually I can write the code, but I really like to know some directions, for a solution. Thanks.

Antonio Caruso

Posted 2018-11-10T14:49:42.500

Reputation: 1

Question was closed 2018-11-10T16:40:15.990

Answers

1

You can't "delay" TCP streams, in particular if there are lots of middleboxes with bufferbloat on the path. Any attempt to do so will sooner or later end up in an unstable state.

If you need network streams that need to be synchronized, have a look a apropriate protocols, e.g. RTP.

Also, this very much looks like an XY question: You think you need to "delay TCP streams" (the Y), but you haven't told us what kind of data you transfer, in what way it needs to be synchronized, etc. (the X)

dirkt

Posted 2018-11-10T14:49:42.500

Reputation: 11 627