Praktikumsblatt 1
This commit is contained in:
parent
754fd64566
commit
2b26d614c8
14
client.py
14
client.py
@ -4,11 +4,15 @@ s = socket.socket()
|
|||||||
host = socket.gethostname()
|
host = socket.gethostname()
|
||||||
port = 4444
|
port = 4444
|
||||||
|
|
||||||
eingabe = input ("Bitte etwas eingeben:")
|
|
||||||
|
|
||||||
|
|
||||||
s.connect((host, port))
|
s.connect((host, port))
|
||||||
s.send(eingabe.encode("utf-8"))
|
|
||||||
bytes = s.recv(1024)
|
while True:
|
||||||
print(bytes.decode("utf-8"))
|
|
||||||
|
msg = input("Bitte geben Sie einen Text ein:")
|
||||||
|
s.send(msg.encode("utf-8"))
|
||||||
|
if msg == "STOPP":
|
||||||
|
break
|
||||||
|
bytes = s.recv(1024)
|
||||||
|
print(bytes.decode("utf-8"))
|
||||||
s.close()
|
s.close()
|
13
server.py
13
server.py
@ -8,13 +8,12 @@ s.listen()
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
(connection, addr) = s.accept()
|
(connection, addr) = s.accept()
|
||||||
print("Verbindung von ", addr)
|
bytes = connection.recv(1024)
|
||||||
data = connection.recv(1024)
|
msg = bytes.decode("utf-8")
|
||||||
data = data.decode("utf-8")
|
ans = msg.upper()
|
||||||
data = data.upper()
|
connection.send(ans.encode("utf-8"))
|
||||||
print(data)
|
connection.close()
|
||||||
connection.send(data.encode("utf-8"))
|
|
||||||
|
|
||||||
#msg = "Danke für das Vorbeischauen!"
|
#msg = "Danke für das Vorbeischauen!"
|
||||||
# connection.send(msg.encode("utf-8"))
|
# connection.send(msg.encode("utf-8"))
|
||||||
connection.close()
|
#connection.close()
|
Loading…
x
Reference in New Issue
Block a user