From: Vsevolod Stakhov Date: Mon, 21 Jan 2019 16:26:41 +0000 (+0000) Subject: [Test] Add dummy udp client X-Git-Tag: 1.9.0~281 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7957fc516a137f4eabab2fbacd30d4ecd99afc8d;p=thirdparty%2Frspamd.git [Test] Add dummy udp client --- diff --git a/test/functional/util/dummy_udp.py b/test/functional/util/dummy_udp.py new file mode 100644 index 0000000000..9946b50f33 --- /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