GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing bugs.python.org — bugs.python.org

import asyncio, socket, sys async def server(close_mode): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) ip = '127.0.0.2' port = 12345 print(f'Listening on {ip}:{port}') print(s) try: s.bind((ip, port)) s.listen() while True: (a, (a_ip, a_port)) = s.accept() print(f'Client connected from {a_ip}:{a_port}') print(a) try: (r,w) = await asyncio.open_connection(sock=a) print('-> ', end='', flush=True) out_line = b'server' w.write(out_line) await w.drain() print(out_line) print('<- ', end='', flush=True) in_line = await r.read(100) print(in_line) finally: if 'S' in close_mode: a.close() if 'A' in close_mode: w.close() await w.wait_closed() print('Closed client socket') print() finally: s.close() print('Closed server socket') close_mode = sys.argv[1] asyncio.run(server(close_mode))
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.