aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-21 16:26:41 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-21 16:26:41 +0000
commit7957fc516a137f4eabab2fbacd30d4ecd99afc8d (patch)
treeae26e4e9fd44f29079d7d0bc254013e6c8d2cd94
parent239f6045f9cfad501d55f926771a2dd7c664c5b2 (diff)
downloadrspamd-7957fc516a137f4eabab2fbacd30d4ecd99afc8d.tar.gz
rspamd-7957fc516a137f4eabab2fbacd30d4ecd99afc8d.zip
[Test] Add dummy udp client
-rw-r--r--test/functional/util/dummy_udp.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/functional/util/dummy_udp.py b/test/functional/util/dummy_udp.py
new file mode 100644
index 000000000..9946b50f3
--- /dev/null
+++ b/test/functional/util/dummy_udp.py
@@ -0,0 +1,19 @@
+import socket
+import sys
+
+UDP_IP = "127.0.0.1"
+
+if __name__ == "__main__":
+ alen = len(sys.argv)
+ if alen > 1:
+ port = int(sys.argv[1])
+ else:
+ port = 5005
+ sock = socket.socket(socket.AF_INET, # Internet
+ socket.SOCK_DGRAM) # UDP
+ sock.bind((UDP_IP, port))
+
+ while True:
+ data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
+ print "received message:", data
+ sock.sendto(data, addr) \ No newline at end of file