Georgey added the comment: Hello David,
Yes I had the same thought with you that the information of socket is lost at operating syetem level. However, I hope at Python level this kind of information will not be lost. Once the socket has been created by incoming connection, the address information of 'laddr' and 'raddr' has been known, and print(socket) will show them. It is not necessarily lost when the connection is broken. Any static method, like assigning an attribute of address to the socket will help. To the the least, Python shall not automatically destroy the socket object simply because it has been closed by Windows. Otherwise any attempt to record the address information of the socket will fail after it is destoyed. The error shown in message 278968 has clearly shown that even as a key, the socket object cannot function because it is already destroyed. ---------------------- sock_err @ <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0> Exception in thread Thread-1: Traceback (most recent call last): File "C:/Users/user/Desktop/SelectWinServer.py", line 39, in handle_sock_err addr_del = sock.getpeername() OSError: [WinError 10038] During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Python34\lib\threading.py", line 911, in _bootstrap_inner self.run() File "C:/Users/user/Desktop/SelectWinServer.py", line 67, in run handle_sock_err(msg[1]) File "C:/Users/user/Desktop/SelectWinServer.py", line 41, in handle_sock_err addr_del = socks2addr[sock] KeyError: <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0> ================= ---------- resolution: not a bug -> remind status: closed -> open _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28447> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com