Martin Panter added the comment: This indicated to me that the socket object has indeed been closed _before_ you call getpeername():
------------- print(sock)>>> <socket.socket [closed] fd=-1, family=AFNET, type=SOCKSTREAM, proto=0> sock.getpeername()>>> OS.Error[WinError10038]an operation was attempted on something that is not a socket ======= In this case, I think ā[closed] fd=-1ā means that both the Python-level socket object, and all objects returned by socket.makefile(), have been closed, so the OS-level socket has probably been closed. In any case, getpeername() is probably trying the invalid file descriptor -1. If there are no copies of the OS-level socket open (e.g. in other processes), then the TCP connection is probably also shut down, but I suspect the problem is the socket object, not the TCP connection. Without code or something demonstrating the bug, Iām pretty sure it is a bug in your program, not in Python. ---------- resolution: remind -> not a bug stage: -> test needed status: open -> closed _______________________________________ 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