commit 7957fc5: [Test] Add dummy udp client

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Jan 21 17:14:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-01-21 16:26:41 +0000
URL: https://github.com/rspamd/rspamd/commit/7957fc516a137f4eabab2fbacd30d4ecd99afc8d

[Test] Add dummy udp client

---
 test/functional/util/dummy_udp.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

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


More information about the Commits mailing list