Hi Nida,
Thanks for reaching out and sorry for the delayed response.
Just making sure: is your program receiving and sending packets at the same time?
startCapture runs in a separate thread and sendPacket runs on the main thread so theoretically they shouldn't interfere with each, however, depending on your system and the OS, they might be running on the same CPU core and in that case the sendPacket will be slower because the startCapture runs in an endless loop to make sure it captures packets as soon as possible, and consumes most of the CPU resources.
I would advise you to check how many CPU cores your system has, the more it has, the better chance each thread will be assigned to a different core. However, the OS cannot guarantee that.
Another option is to run
startCapture and
sendPacket in two different processes, which might increase the chance they'll run on separate cores.
Please let me know if any of these suggestions work for you.
Thanks,
PcapPlusPlus maintainer