Browse Source

init

master
Nadege 5 years ago
parent
commit
1cb2a8973e
2 changed files with 30 additions and 0 deletions
  1. 13
    0
      client.py
  2. 17
    0
      server.py

+ 13
- 0
client.py View File

@@ -0,0 +1,13 @@
import socket
s = socket.socket()
host = socket.gethostname()
port = 22445


s.connect((host, port))
message = input('eingabe: ')
#bytes = s.sendmsg(message.encode('utf-8'))
test = s.send(message.encode('utf-8'))
msg = s.recv(1024)
print (msg.decode('utf-8'))
s.close()

+ 17
- 0
server.py View File

@@ -0,0 +1,17 @@
import socket

s = socket.socket()
host = socket.gethostname()
port = 22445
s.bind((host, port))
s.listen()


while True:
(connection, addr) = s.accept()
print('verbindung von ', addr)
bytes = connection.recv(1024)
msg = bytes.decode('utf-8')
msg = msg.upper()
connection.send(msg.encode('utf-8'))
connection.close()

Loading…
Cancel
Save