mirror of
https://github.com/rspamd/rspamd.git
synced 2024-09-13 15:45:47 +02:00
aa3d119209
- Fix more deprecated Robot Framework syntax - Remove log following - Remove some artefacts in teardown - Restore use of demjson
27 lines
637 B
Python
Executable File
27 lines
637 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import socket
|
|
import sys
|
|
|
|
import dummy_killer
|
|
|
|
UDP_IP = "127.0.0.1"
|
|
PID = "/tmp/dummy_udp.pid"
|
|
|
|
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.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
|
sock.bind((UDP_IP, port))
|
|
dummy_killer.write_pid(PID)
|
|
|
|
while True:
|
|
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
|
|
print("received message:", data)
|
|
sock.sendto(data, addr)
|