import socket class OcaAOcaClient: def __init__(self, host, port): self.host = host self.port = port self.client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.client_socket.connect((self.host, self.port)) def receive_message(self): return self.client_socket.recv(1024).decode() if __name__ == "__main__": HOST = '192.168.100.252' PORT = 2000 client = OcaAOcaClient(HOST, PORT) current_turn = False while True: while current_turn == False: msg = client.receive_message() if msg == "your_turn": current_turn = True else: print(msg) while current_turn == True: message = input("Type 'roll': ") client.client_socket.sendall(message.encode('utf-8')) if message.lower() == 'roll': client.client_socket.sendall(message.encode('utf-8')) current_turn = False