mirror of
https://github.com/Xevion/tcp-chat.git
synced 2025-12-07 20:08:38 -06:00
create improved server/client commandline launching method
This commit is contained in:
0
server/__init__.py
Normal file
0
server/__init__.py
Normal file
@@ -17,6 +17,7 @@ logger = logging.getLogger('server')
|
||||
|
||||
clients = []
|
||||
|
||||
|
||||
# Receiving / Listening Function
|
||||
def receive():
|
||||
while True:
|
||||
@@ -25,8 +26,12 @@ def receive():
|
||||
logger.info(f"New connection from {address}")
|
||||
|
||||
client = handler.Client(conn, address, clients)
|
||||
clients.append(client)
|
||||
client.request_nickname()
|
||||
|
||||
# Start Handling Thread For Client
|
||||
thread = threading.Thread(target=client.handle, name=client.id[:8])
|
||||
thread.start()
|
||||
|
||||
|
||||
receive()
|
||||
|
||||
Reference in New Issue
Block a user