@asyncio.coroutine<EOL>def stream_from_fd(fd, loop):
reader = asyncio.StreamReader(loop=loop)<EOL>protocol = asyncio.StreamReaderProtocol(reader, loop=loop)<EOL>waiter = asyncio.futures.Future(loop=loop)<EOL>transport = UnixFileDescriptorTransport(<EOL>loop=loop,<EOL>fileno=fd,<EOL>protocol=protocol,<EOL>waiter=waiter,<EOL>)<EOL>try:<EOL><INDENT>yield from waiter<EOL><DEDENT>except Exception:<EOL><INDENT>transport.close()<EOL><DEDENT>if loop.get_debug():<EOL><INDENT>logger.debug("<STR_LIT>", fd, transport, protocol)<EOL><DEDENT>return reader, transport<EOL>
Recieve a streamer for a given file descriptor.