Browse Source

client und Server implementiert

master
Nadege 5 years ago
parent
commit
b470885871
2 changed files with 9 additions and 5 deletions
  1. 4
    3
      client.py
  2. 5
    2
      server.py

+ 4
- 3
client.py View File

@@ -1,9 +1,10 @@
import socket
s= socket.socket()
host=socket.gethostname()
port= 12345
port= 1345
s.connect((host , port))
msg = input('geben sie was ein: ')
bytes= s.recv(1024)
print(bytes.decode('utf-8') )
bytes= s.send(msg.encode('utf-8'))
message = s.recv(1024)
print(message.decode('utf-8'))
s.close()

sever.py → server.py View File

@@ -1,12 +1,15 @@
import socket
s = socket.socket()
host = socket.gethostname()
port = 12345
port = 1345
s.bind((host , port))
s.listen()
while True:
(connection, addr )= s.accept()
print('verbindung von', addr)
msg= 'Danke für das vorbeischauen!'
connection.send(msg.encode('utf-8'))
serge= s.recv(1024)
message = serge.decode('utf-8')
sendmessage= message.upper()
connection.send(sendmessage.encode('utf-8'))
connection.close()

Loading…
Cancel
Save