2 from __future__
import absolute_import
, division
, print_function
5 from time
import strftime
11 print("completion_logger_server.py <listen address> <listen port> <log file>")
15 port
= int(sys
.argv
[2])
19 # Create socket and bind to address
20 UDPSock
= socket(AF_INET
, SOCK_DGRAM
)
23 print("Listing on {0}:{1} and logging to '{2}'".format(host
, port
, sys
.argv
[3]))
25 # Open the logging file.
26 f
= open(sys
.argv
[3], "a")
30 data
, addr
= UDPSock
.recvfrom(buf
)
36 '"time": "{0}"'.format(
37 datetime
.datetime
.utcnow().strftime("%Y-%m-%d %H:%M:%S")
40 f
.write(', "sender": "{0}" '.format(addr
[0]))
50 if __name__
== "__main__":