Browse Source

server

master
Mai Gillmann 4 years ago
parent
commit
1f09919ed7
2 changed files with 10 additions and 6 deletions
  1. 5
    4
      demo_client.py
  2. 5
    2
      demo_server.py

+ 5
- 4
demo_client.py View File

@@ -7,9 +7,10 @@ host = socket.gethostname()
port = 12346

s.connect((host, port))
s.send(eingabe)
bytes = s.recv(1024)
print(bytes.decode('utf-8'))
print('Receipt')
s.send(eingabe.encode('utf-8'))
#bytes = s.recv(1024)
#print(bytes.decode('utf-8'))
print('Gesendet')
msg3 = s.recv(1024)

s.close()

+ 5
- 2
demo_server.py View File

@@ -10,6 +10,9 @@ s.listen()
while True:
(connection, addr) = s.accept()
print("Verbindung von ", addr)
msg = "Danke für das Vorbeischauen!"
connection.send(msg.encode('utf-8'))
msg2 = connection.recv(1024)
new_msg2 = msg2.decode('utf-8') .upper()
print(new_msg2)
connection.send(new_msg2.encode('utf-8'))
#connection.send(msg.encode('utf-8'))
connection.close()

Loading…
Cancel
Save