From 27a7d32ee3a0586e2e913430f67f010638218007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elvis=20Pf=C3=BCtzenreuter?= Date: Thu, 14 Oct 2010 21:37:33 -0300 Subject: [PATCH] Added comment to unix fd passing client example --- examples/unix-fd-client.py | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/examples/unix-fd-client.py b/examples/unix-fd-client.py index 89f7fd7..ce1011d 100755 --- a/examples/unix-fd-client.py +++ b/examples/unix-fd-client.py @@ -62,6 +62,13 @@ def main(): # We want to encapsulate the integer fd into a Python file or socket object f = os.fdopen(fd, "r") + # If it were an UNIX socket we would do + # sk = socket.fromfd(fd, socket.AF_UNIX, socket.SOCK_STREAM) + # os.close(fd) + # + # fromfd() dup()s the descriptor so we need to close the original, + # otherwise it 'leaks' (stays open until program exits). + f.seek(0) print f.read() -- 1.7.0.4