'Proxy tcp connection from source to dest.'

def one_way_proxy(self, source, dest):

    while True:
        try:
            d = source.recv(32384)
        except Exception:
            d = None
        if ((d is None) or (len(d) == 0)):
            dest.shutdown(socket.SHUT_WR)
            break
        try:
            dest.sendall(d)
        except Exception:
            source.close()
            dest.close()
            break
