Christian Heimes <> added the comment:

The problem is fixed and your example behaves as expected.

The laddr string is the result of inside.getsockname() and raddr string is the 
result of inside.getpeername(). In your example, inside and client share the 
same file descriptor. When the function exits client goes out of scope, the 
reference count of client drops to 0, the object gets deallocated and Python 
closes the shared file descriptor. In outside, the shared fd is gone and 
outside.getsockname() and outside.getpeername() fail. Basically the outside 
socket is dead because its fd has been closed.

You have to duplicate the fd or detach the socket to keep the fd open.


Python tracker <>
Python-bugs-list mailing list

Reply via email to