def interact_in_memory(client_conn, server_conn):
 wrote = True
 while wrote:
  wrote = False
  for (read, write) in [(client_conn, server_conn), (server_conn, client_conn)]:
   try:
    data = read.recv((2 ** 16))
   except WantReadError:
    pass
   else:
    return (read, data)
   while True:
    try:
     dirty = read.bio_read(4096)
    except WantReadError:
     break
    else:
     wrote = True
     write.bio_write(dirty)

def interact_in_memory ( client_conn , server_conn ) : wrote = True while wrote : wrote = False for ( read , write ) in [ ( client_conn , server_conn ) , ( server_conn , client_conn ) ] : try : data = read . recv ( ( 2 ** 16 ) ) except WantReadError : pass else : return ( read , data ) while True : try : dirty = read . bio_read ( 4096 ) except WantReadError : break else : wrote = True write . bio_write ( dirty )
try to read application bytes from each of the two connection objects .