On 11/08/2017 09:48 AM, Hojoon Yang via USRP-users wrote:
Hi all,
In the example tx_timed_samples.cpp
there is tx_stream->send(... , ... , ..., timeout)
How the timeout works?
when I set the value of timeout zero or 0.00001, I expect that the
terminal show the "Send timeout..."
because it will not have enough time to send all samples during
timeout 0.(I expect that it will send 0 samples)
it will timeout before entire transmission of samples..
But seems that it works perfectly.. it prints out Sent packet : 2044
which is the maximum value of samples..
How the timeout works!?!?
Thanks in advance!!
size_t num_acc_samps = 0; //number of accumulated samples
while(num_acc_samps < total_num_samps){
size_t samps_to_send = std::min(total_num_samps -
num_acc_samps, buff.size());
//send a single packet
size_t num_tx_samps = tx_stream->send(
&buff.front(), samps_to_send, md, timeout
);
//do not use time spec for subsequent packets
md.has_time_spec = false;
if (num_tx_samps < samps_to_send) std::cerr << "Send
timeout..." << std::endl;
if(verbose) std::cout << boost::format("Sent packet: %u
samples") % num_tx_samps << std::endl;
num_acc_samps += num_tx_samps;
}
//send a mini EOB packet
md.end_of_burst = true;
tx_stream->send("", 0, md);
The timeout is, as far as I know, applied to the underlying socket call,
or libusb write call. I many situations, that kernel-call won't block,
because the
kernel-side buffering is large enough that it will almost never need
to block.
_______________________________________________
USRP-users mailing list
USRP-users@lists.ettus.com
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com