From 674e29c7a0546163d6213fcb08e29d22e4254d52 Mon Sep 17 00:00:00 2001 From: Nova Cat Date: Sun, 8 Dec 2024 17:36:59 -0800 Subject: [PATCH] fix scoket --- server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.py b/server.py index f60288d..0e79234 100644 --- a/server.py +++ b/server.py @@ -5,7 +5,8 @@ print("Welcome! /ᐠ ˵> ⩊ <˵マ") import socket, time, threading, traceback from requests import get ip = get('https://api.ipify.org').content.decode('utf8') -tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.SO_REUSEADDR) +tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +tcp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server = "127.0.0.1" displayname = "SWEE.codes" server_address = ('0.0.0.0', 6667) @@ -135,7 +136,6 @@ try: threading.Thread(target=session, daemon=True, args=[connection, client]).start() except: print("Shutting down...") - for i, j in nickname_list.items(): - j.close() time.sleep(2) + tcp_socket.shutdown(1) tcp_socket.close() \ No newline at end of file