Version_1_final
This commit is contained in:
parent
cf004f2950
commit
482071b44a
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal 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>
|
24
Client.py
24
Client.py
@ -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)
|
||||
|
||||
|
||||
|
||||
|
21
Server.py
21
Server.py
@ -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()
|
Loading…
x
Reference in New Issue
Block a user