Last active
December 8, 2017 05:13
-
-
Save Yoiter/f7d855772eefa23d52af5f5a8e50f842 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
s = socket.socket() | |
host = '127.0.0.1' | |
port = 50004 | |
s.bind((host, port)) | |
s.listen(5) | |
conn = None | |
word = input("Hangman word:" ) | |
while True: | |
if conn is None: | |
print("[Waiting for connection...]") | |
conn, addr = s.accept() | |
print("Got connected from", addr) | |
else: | |
conn.send(word.encode('UTF-8')) | |
print("[Waiting for results...]") | |
print(str(conn.recv(1024).decode('UTF-8'))) | |
if str(conn.recv(1024).decode('UTF-8')) == "Please send hint": | |
hint = input("hint: ") | |
sendhint = str("hint: " + hint) | |
conn.send(hint.encode('UTF-8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment