This commit is contained in:
hohwielerto72856 2021-10-20 12:39:40 +02:00
commit 8ef4b50673
3 changed files with 43 additions and 0 deletions

0
YingYang.py Normal file
View File

24
client.py Normal file
View File

@ -0,0 +1,24 @@
# This is a sample Python script.
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
import socket
s = socket.socket()
host = socket.gethostname()
port = 12345
s.connect((host, port))
while True:
msg = input('Wort eingeben: ')
if msg != 'STOP':
s.send(msg.encode('utf-8'))
bytes = s.recv(1024)
print(bytes.decode('utf-8'))
else:
break
# See PyCharm help at https://www.jetbrains.com/help/pycharm/

19
server.py Normal file
View File

@ -0,0 +1,19 @@
import socket
s = socket.socket()
host = socket.gethostname()
port = 12345
s.bind((host, port))
s.listen()
while True:
(connection, addr) = s.accept()
print('Verbindung von ', addr)
req = connection.recv(1024)
msg = req.decode('utf-8')
if msg != 'STOP':
msg = msg.upper()
connection.send(msg.encode('utf-8'))
else:
connection.close()