commit 26ffda7a5d4698bb1d59e2246aa35ac8ecbf4022 Author: starcalc Date: Thu Sep 6 21:44:46 2018 +0200 Add new file diff --git a/run.py b/run.py new file mode 100644 index 0000000..1fedf8b --- /dev/null +++ b/run.py @@ -0,0 +1,22 @@ +#!/usr/bin/python3 + +import RPi.GPIO as GPIO +import time +from datetime import datetime +import socket +GPIO.setmode(GPIO.BCM) +GPIO.setup(17, GPIO.OUT) +GPIO.output(17,GPIO.HIGH) +serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +serversocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) +serversocket.bind(('192.168.1.1', 8000)) +serversocket.listen(5) # become a server socket, maximum 5 connections +print (round(datetime.utcnow().timestamp() * 1000)) +# while True: +connection, address = serversocket.accept() +buf = connection.recv(64) +if len(buf) > 0: + print (buf) +print (round(datetime.utcnow().timestamp() * 1000)) +serversocket.close() +GPIO.output(17,GPIO.LOW)