summaryrefslogtreecommitdiff
path: root/testing/rect.py
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-06-25 09:19:01 -0400
committerirungentoo <irungentoo@gmail.com>2013-06-25 09:19:01 -0400
commitc93858110bb17ce35143bae7ba9aa68fac93f46b (patch)
treecf2df0b4b2af4d829e3583fedc1fe7e30f666a57 /testing/rect.py
parentb9563fd9e27261ef3d48cb82decfa198e61cca86 (diff)
DHT almost done, started testing. Fixed ADDR compiling problem. No more warnings with GCC and clang.
Diffstat (limited to 'testing/rect.py')
-rw-r--r--testing/rect.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/rect.py b/testing/rect.py
new file mode 100644
index 00000000..94baeaec
--- /dev/null
+++ b/testing/rect.py
@@ -0,0 +1,19 @@
1#basic python UDP script
2#for testing only
3import socket
4
5UDP_IP = "127.0.0.1"
6UDP_PORT = 5004
7
8sock = socket.socket(socket.AF_INET, # Internet
9 socket.SOCK_DGRAM) # UDP
10sock.bind((UDP_IP, UDP_PORT))
11
12#send ping request to our DHT on localhost.
13sock.sendto("0012345678".decode("hex") + "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH", ('127.0.0.1', 33445))
14
15#print all packets recieved and respond to ping requests properly
16while True:
17 data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
18 print "received message:", data, " From:", addr
19 sock.sendto("01".decode('hex') + data[1:5] + "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH", addr)