Init commit

This commit is contained in:
2017-02-10 12:43:24 +01:00
commit 69215b7e4c
4 changed files with 72 additions and 0 deletions

23
readFileHandler.py Executable file
View File

@@ -0,0 +1,23 @@
from socket import *
# Define the socket communicating will transfered
serverSocket = socket(AF_INET, SOCK_DGRAM)
serverSocket.bind(('', 12001))
def readFile():
with open('/home/kevin/homeCheck/times.txt', 'r') as content_file:
content = content_file.read()
return content
while True:
# Save the message and return address to variables.
message, address = serverSocket.recvfrom(1024)
print(message, address) # Debug print
# This should prob be cases and not if's, but works to get the right info user requests.
if (message == 'get_times'):
return_message = readFile()
# Returns message to return address.
serverSocket.sendto(return_message, address)