Commit 057f43dc authored by Emanuel Czar Reyes's avatar Emanuel Czar Reyes

Initialized with client and server

parents
Pipeline #2548 failed with stages
import socket
conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
conn.connect(("192.168.1.2", 5050)) #change to your ipv4 wifi address
#copied from sample
conn.sendall(b"has connected")
data = conn.recv(1024)
print(f"Received {data!r}")
\ No newline at end of file
import socket
HOST = "192.168.1.2" #change to your ipv4 wifi address
PORT = 5050
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((HOST,PORT))
server.listen(1)
conn, addr = server.accept()
#handle_game --function to handle game
#copied from sample
with conn:
print(f"Connected by {addr}")
while True:
data = conn.recv(1024)
print(data)
if not data:
break
conn.sendall(data)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment