Async Serial + Socket Bridge
Write a Python script that asynchronously reads data from a serial port and forwards it to a TCP socket client. Use asyncio for concurrency.
Constraints
- Must use asyncio, not threads.
- Serial read must be non-blocking.
- TCP server port fixed at 9000.
- Forward every received byte without modification.
- Stop when client disconnects.
- Assume pyserial-asyncio is available.
1import asyncio2import serial_asyncio3 4async def bridge():5 # TODO: implement bridge6 pass7 8async def main():9 await bridge()10 11if __name__ == '__main__':12 asyncio.run(main())