hey i'm working on a chat app and can't get any further at this point. The different clients connect to the server and can send messages successfully. But only the message from one client is displayed and not the message from the second one.
import socket
import _thread
s = socket.socket()
host = socket.gethostname()
print("Server wird auf folgendem Host gestartet: ", host)
port = 8080
s.bind(('127.0.0.1', 50010))
s.listen()
print("Server erfolgreich verbunden")
print("Server wartet auf Verbindungen...")
def serverlisten():
while True:
s.listen()
conn, addr = s.accept()
print(addr, " hat sich mit dem Server verbunden und ist online")
_thread.start_new_thread(serverlisten, ())
conn, addr = s.accept()
print(addr, " hat sich mit dem Server verbunden und ist online")
while True:
incoming_message = conn.recv(1024)
incoming_message = incoming_message.decode()
print(addr, incoming_message)