Changeset 5893 in josm for trunk


Ignore:
Timestamp:
2013-04-21T12:34:28+02:00 (12 years ago)
Author:
stoecker
Message:

see #8562 - remote control using dual stack

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpServer.java

    r5861 r5893  
    22package org.openstreetmap.josm.io.remotecontrol;
    33
    4 import static org.openstreetmap.josm.tools.I18n.tr;
     4import static org.openstreetmap.josm.tools.I18n.marktr;
    55
    66import java.io.IOException;
     
    1010import java.net.SocketException;
    1111import java.net.InetAddress;
     12
     13import org.openstreetmap.josm.Main;
    1214
    1315/**
     
    3436            stopRemoteControlHttpServer();
    3537
    36             instance = new RemoteControlHttpServer(DEFAULT_PORT);
     38            instance = new RemoteControlHttpServer(Main.pref.getInteger("remote.control.port", DEFAULT_PORT));
    3739            instance.start();
    3840        } catch (BindException ex) {
    39             System.err.println(tr("Warning: Cannot start remotecontrol server on port {0}: {1}",
    40                     Integer.toString(DEFAULT_PORT), ex.getLocalizedMessage()));
     41            Main.warn(marktr("Warning: Cannot start remotecontrol server on port {0}: {1}"),
     42                    Integer.toString(DEFAULT_PORT), ex.getLocalizedMessage());
    4143        } catch (IOException ioe) {
    4244            ioe.printStackTrace();
     
    7274        // Also make sure we only listen
    7375        // on the local interface so nobody from the outside can connect!
     76        // NOTE: On a dual stack machine with old Windows OS this may not listen on both interfaces!
    7477        this.server = new ServerSocket(port, 1,
    75             InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
     78            InetAddress.getByName(Main.pref.get("remote.control.host", "localhost")));
    7679    }
    7780
     
    8184    public void run()
    8285    {
    83         System.out.println("RemoteControl::Accepting connections on port " + server.getLocalPort());
     86        Main.info(marktr("RemoteControl::Accepting connections on port {0}"),
     87             Integer.toString(server.getLocalPort()));
    8488        while (true)
    8589        {
     
    109113    {
    110114        server.close();
    111         System.out.println("RemoteControl::Server stopped.");
     115        Main.info(marktr("RemoteControl::Server stopped."));
    112116    }
    113117}
Note: See TracChangeset for help on using the changeset viewer.