DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
dpdklibs
scripts
dpdklibs_udp_sender.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
import
socket
4
import
argparse
5
6
parser = argparse.ArgumentParser()
7
parser.add_argument(
'ip'
, help=
'ip of the destination'
)
8
parser.add_argument(
'--size'
, default=5, type=int, help=
'Size of the message to send (in bytes)'
)
9
10
args = parser.parse_args()
11
12
UDP_TARGET_IP = args.ip
13
UDP_TARGET_PORT = 4444
14
15
payload =
'hello'
* ((args.size + 4) // 5)
16
payload = payload[:args.size]
17
18
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
19
ret = sock.sendto(payload.encode(), (UDP_TARGET_IP, UDP_TARGET_PORT))
20
print(
"Sent {0} bytes"
.format(ret))
21
22
sock.close()
Generated on
for DUNE-DAQ by
1.17.0