send a list of packets instead of packets in a loop or alternatively modify the code to reuse the socket