summaryrefslogtreecommitdiff
path: root/gr-msdd6000/src/python_test/flood_udp.py
blob: e59208a7a985ed5be5a40071aa0703f4b24c3c58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/python

from socket import *
import string
import time
import struct;
import random;

msdd_port = 10001
msdd_host = "10.45.4.43"

my_udp_addr = ("10.45.1.229",10001);

buf = 1024;

#myport = random.randint(1025,65535);
#my_tcp_addr = ("10.45.1.229",myport);
#TCPSock = socket(AF_INET,SOCK_STREAM);
#TCPSock.bind(my_tcp_addr);
#TCPSock.connect((msdd_host,msdd_port));

UDPSock = socket(AF_INET,SOCK_DGRAM);
UDPSock.bind(my_udp_addr);

SETS_STREAM = 0xffffffff;

f_mhz = 2400;
f_hz = 1;
gain = 3;
samples = 512;
decim = 4;
#sets = 16;
sets = SETS_STREAM;
window =  3;
mode = 1;



for first_byte in range(0,0xff):
	for second_byte in range(0,0xff):
		for third_byte in range(0,0xff):
			data = struct.pack("!III", first_byte, second_byte,third_byte);
			UDPSock.sendto(data, (msdd_host,msdd_port))

	
# construct the 3 different request type packets
#fft_data = struct.pack("<IIIIIIIIII", 0x02, 0x20, f_mhz, f_hz, gain,window, samples, decim, mode,sets);
#raw_data = struct.pack("<IIIIIIII", 0x01, 0x18, f_mhz, f_hz, gain,samples, decim,sets);
#stat_data = struct.pack("!II", 0x0000, 0x0000)

# send appropriate udp request packet