Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bindaddress option #3

Merged
merged 2 commits into from
May 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.iml
.idea/
.gradle/
build/
hm2mqtt.devcache
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ Examples:
Local address used when sending init (callback) requests to the XML-RPC server. Default is
the result of getHostAddress(). Set this when hm2mqtt has trouble determining your local host's
address automatically.

- hm.bindaddress

Local address and port used to listen for callback requests. If not specified hm2mqtt will pick a valid local address
and a random port

Example: Listen on all local adresses on port 3333: 0.0.0.0:3333

- hm.disableReGa

Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/tellerulam/hm2mqtt/XMLRPCServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ public static String init() throws IOException
{
ss=new ServerSocket();
ss.setReuseAddress(true);
ss.bind(null);
String bindaddress=System.getProperty("hm2mqtt.hm.bindaddress");
if(bindaddress == null)
ss.bind(null);
else{
String[] parts = bindaddress.split(":");
ss.bind(new InetSocketAddress(parts[0], Integer.parseInt(parts[1])));
}
new XMLRPCAcceptor().start();
String localhost=System.getProperty("hm2mqtt.hm.localhost");
if(localhost==null)
Expand Down