Browse Source

client and server modified

master
parent
commit
a67dfb7314
2 changed files with 4 additions and 4 deletions
  1. 1
    1
      client.py
  2. 3
    3
      server.py

+ 1
- 1
client.py View File

import socket import socket
s= socket.socket() s= socket.socket()
host=socket.gethostname() host=socket.gethostname()
port= 1345
port= 13345
s.connect((host , port)) s.connect((host , port))
msg = input('geben sie was ein: ') msg = input('geben sie was ein: ')
bytes= s.send(msg.encode('utf-8')) bytes= s.send(msg.encode('utf-8'))

+ 3
- 3
server.py View File

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

Loading…
Cancel
Save