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