def start_via(gateway, hostport=None):
    """ return a host, port tuple,
        after instanciating a socketserver on the given gateway
    """
    if hostport is None:
        host, port = 'localhost', 0
    else:
        host, port = hostport
    from execnet.script import socketserver
    channel = gateway.remote_exec(socketserver)
    channel.send((host, port))
    realhost, realport = channel.receive()
    if not realhost or realhost == '0.0.0.0':
        realhost = 'localhost'
    return realhost, realport
