Version_1_final

This commit is contained in:
Kevin Holzschuh 2019-10-15 15:23:23 +02:00
parent cf004f2950
commit 482071b44a
3 changed files with 40 additions and 11 deletions

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -2,17 +2,27 @@ import socket
SOCKET = socket.socket()
HOST = socket.gethostname()
PORT = 45677
# Eingabe
eingabe = input("Eingabe: ")
PORT = 45670
# Verbindung zum Server
SOCKET.connect((HOST, PORT))
SOCKET.send(eingabe.encode("utf-8"))
while True:
eingabe = input("Eingabe: ")
msg = eingabe.encode("utf-8")
SOCKET.send(msg)
if eingabe.upper() == "STOP":
SOCKET.close()
break
msg = SOCKET.recv(1024)
msg = msg.decode("utf-8")
print(msg)

View File

@ -2,18 +2,31 @@ import socket
SOCKET = socket.socket()
HOST = socket.gethostname()
PORT = 45677
PORT = 45670
SOCKET.bind((HOST, PORT))
SOCKET.listen()
while True:
(connection, addr) = SOCKET.accept()
(connection, addr) = SOCKET.accept()
print("Server: " + addr[0] + " Port: " + str(addr[1]))
eingabe = connection.recv(1024)
print(eingabe.decode)
eingabe = connection.recv(1024)
msg = eingabe.decode("utf-8")
msg = msg.upper()
print(msg)
if msg == "STOP":
connection.close()
SOCKET.close()
break
connection.send(msg.encode("utf-8"))
SOCKET.close()