Browse Source

v2

master
Tu Quyen Tran Ngoc 5 years ago
parent
commit
2988f4fb71
2 changed files with 32 additions and 0 deletions
  1. 17
    0
      clie2_file.py
  2. 15
    0
      serv2_file.py

+ 17
- 0
clie2_file.py View File

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

eingabe = input("Bitte etwas eingeben: ")

s = socket.socket()
host = socket.gethostname()
port = 12345
s.connect((host, port))

while eingabe != "STOP":

s.send(eingabe.encode('utf-8'))

eingabe = input("Bitte etwas eingeben: ")

else:
s.close()

+ 15
- 0
serv2_file.py View File

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

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

while True:
(connection, addr) = s.accept()

msg = connection.recv(1024)
msgReturn = msg.decode('utf-8').upper()
connection.send(msgReturn.encode('utf-8'))
connection.close()

Loading…
Cancel
Save