summaryrefslogtreecommitdiff
path: root/testing/rect.py
diff options
context:
space:
mode:
Diffstat (limited to 'testing/rect.py')
-rw-r--r--testing/rect.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/testing/rect.py b/testing/rect.py
index 59d6c158..85e70810 100644
--- a/testing/rect.py
+++ b/testing/rect.py
@@ -18,17 +18,17 @@ a = 1;
18#send ping request to our DHT on localhost. 18#send ping request to our DHT on localhost.
19sock.sendto("0012345678".decode("hex") + client_id, ('127.0.0.1', 33445)) 19sock.sendto("0012345678".decode("hex") + client_id, ('127.0.0.1', 33445))
20 20
21#print all packets recieved and respond to ping requests properly 21#print all packets received and respond to ping requests properly
22while True: 22while True:
23 data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes 23 data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
24 print "received message:", data.encode('hex'), " From:", addr 24 print "received message:", data.encode('hex'), " From:", addr
25 #if we recieve a ping request. 25 #if we receive a ping request.
26 print data[0].encode('hex') 26 print data[0].encode('hex')
27 if data[0] == "00".decode('hex'): 27 if data[0] == "00".decode('hex'):
28 print "Sending ping resp" 28 print "Sending ping resp"
29 sock.sendto("01".decode('hex') + data[1:5] + client_id, addr) 29 sock.sendto("01".decode('hex') + data[1:5] + client_id, addr)
30 30
31 #if we recieve a get_nodes request. 31 #if we receive a get_nodes request.
32 if data[0] == "02".decode('hex'): 32 if data[0] == "02".decode('hex'):
33 print "Sending getn resp" 33 print "Sending getn resp"
34 #send send nodes packet with a couple 127.0.0.1 ips and ports. 34 #send send nodes packet with a couple 127.0.0.1 ips and ports.