aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/TrackerServer.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-12-09 11:41:38 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2012-12-09 11:41:38 +1300
commitd0b8756a27562917323fcf7f4476629752814e70 (patch)
tree191f7637702801e01c2254b4a1329e569b0c3126 /src/org/traccar/TrackerServer.java
parentd6a470c9bbc4cc6fea8d7b20ff34fbcb463fa2a5 (diff)
downloadtrackermap-server-d0b8756a27562917323fcf7f4476629752814e70.tar.gz
trackermap-server-d0b8756a27562917323fcf7f4476629752814e70.tar.bz2
trackermap-server-d0b8756a27562917323fcf7f4476629752814e70.zip
Option to set protocol interface (fix #91)
Diffstat (limited to 'src/org/traccar/TrackerServer.java')
-rw-r--r--src/org/traccar/TrackerServer.java25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/org/traccar/TrackerServer.java b/src/org/traccar/TrackerServer.java
index b2e8c0a7f..56a9a2946 100644
--- a/src/org/traccar/TrackerServer.java
+++ b/src/org/traccar/TrackerServer.java
@@ -53,8 +53,21 @@ public class TrackerServer extends ServerBootstrap {
return port;
}
- private void setPort(Integer newPort) {
- port = newPort;
+ private void setPort(Integer port) {
+ this.port = port;
+ }
+
+ /**
+ * Server listening interface
+ */
+ private String address;
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
}
/**
@@ -77,7 +90,13 @@ public class TrackerServer extends ServerBootstrap {
* Start server
*/
public void start() {
- Channel channel = bind(new InetSocketAddress(getPort()));
+ InetSocketAddress endpoint;
+ if (address == null) {
+ endpoint = new InetSocketAddress(port);
+ } else {
+ endpoint = new InetSocketAddress(address, port);
+ }
+ Channel channel = bind(endpoint);
getChannelGroup().add(channel);
}