void mode_4(pfq::socket &q, int64_t num) { for(int64_t n = 0; n < num;) { if (q.send_async(pfq::const_buffer(reinterpret_cast<const char *>(ping), sizeof(ping)), 128)) n++; } q.wakeup_tx_thread(); }
void mode_2(pfq::socket &q, int64_t num) { for(int64_t n = 0; n < num;) { if (q.send_sync(pfq::const_buffer(reinterpret_cast<const char *>(ping), sizeof(ping)), 128)) n++; } q.tx_queue_flush(); }
void mode_1(pfq::socket &q, int64_t num) { for(int64_t n = 0; n < num;) { if (q.send(pfq::const_buffer(reinterpret_cast<const char *>(ping), sizeof(ping)))) n++; } }
void send_packets_async(pfq::socket &q, int64_t num) { std::cout << "sending " << num << " packets (async):" << std::endl; for(int64_t n = 0; n < num;) { if (q.send_async(pfq::const_buffer(reinterpret_cast<const char *>(ping), sizeof(ping)), 1)) n++; } }