init
This commit is contained in:
commit
8ef4b50673
0
YingYang.py
Normal file
0
YingYang.py
Normal file
24
client.py
Normal file
24
client.py
Normal 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
19
server.py
Normal 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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user