Now that with #9 and #15 the Transport can control the flow of the data in CFDP transaction, it is time to look on implementing target bandwidth for the UDP transport.
Currently the UDP transport contains some sleeps which dictate practically the rate at which PDUs are sent. Instead we want a configured data rate to be used as maximum.
In order to achieve that, I will split the current UDP transport in two threads - one for sending and the other one for receiving data. The receiver is straightforward: it is blocked on reading UDP datagrams from the socket, when a datagram is received, it turns it into a PDU and sends it over the channel to the daemon for processing.
The sender looks a little bit more tricky. A simple approach is just to use a sleep with the sleep duration computed based on the number of bytes sent in the last n seconds.
But I will look at the iperf source code to see what kind of tricks they use to implement the bandwith (iperf -b) targets.
Now that with #9 and #15 the Transport can control the flow of the data in CFDP transaction, it is time to look on implementing target bandwidth for the UDP transport.
Currently the UDP transport contains some sleeps which dictate practically the rate at which PDUs are sent. Instead we want a configured data rate to be used as maximum.
In order to achieve that, I will split the current UDP transport in two threads - one for sending and the other one for receiving data. The receiver is straightforward: it is blocked on reading UDP datagrams from the socket, when a datagram is received, it turns it into a PDU and sends it over the channel to the daemon for processing.
The sender looks a little bit more tricky. A simple approach is just to use a sleep with the sleep duration computed based on the number of bytes sent in the last n seconds.
But I will look at the iperf source code to see what kind of tricks they use to implement the bandwith (iperf -b) targets.