6parser = argparse.ArgumentParser()
7parser.add_argument(
'ip', help=
'ip of the destination')
8parser.add_argument(
'--size', default=5, type=int, help=
'Size of the message to send (in bytes)')
10args = parser.parse_args()
12UDP_TARGET_IP = args.ip
15payload =
'hello' * ((args.size + 4) // 5)
16payload = payload[:args.size]
18sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
19ret = sock.sendto(payload.encode(), (UDP_TARGET_IP, UDP_TARGET_PORT))
20print(
"Sent {0} bytes".format(ret))