client server communication implemented

This commit is contained in:
2020-06-07 22:55:45 +02:00
parent 28393b1dd4
commit 282c3f3a39
2 changed files with 13 additions and 10 deletions
+6 -4
View File
@@ -1,7 +1,8 @@
import socket
import ws2801
def start_server():
host = socket.gethostname()
def start():
host = "0.0.0.0"
port = 5000
server_socket = socket.socket()
@@ -14,8 +15,9 @@ def start_server():
while True:
# receive data stream. it won't accept data packet greater than 1024 bytes
data = conn.recv(1024).decode()
print(str(data))
r,g,b = ws2801.hex_to_rgb(data)
ws2801.set_color(r,g,b)
conn.close() # close the connection
start()