Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadCommandSystem
Commits
fce42683
Commit
fce42683
authored
Apr 06, 2020
by
yannick legoc
Browse files
Added option serverPort for remote clients which do not have a known hostname
parent
0d889c15
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/fr/ill/ics/util/ConfigManager.java
View file @
fce42683
...
...
@@ -27,6 +27,8 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashSet
;
...
...
@@ -564,6 +566,7 @@ public class ConfigManager {
public
String
getServerEndpoint
()
{
// The server endpoint can be entirely defined in the variable 'serverEndpoint'.
String
serverEndpoint
=
getStringOrNothingAtAll
(
"serverEndpoint"
);
if
(
serverEndpoint
!=
null
)
{
...
...
@@ -571,6 +574,24 @@ public class ConfigManager {
return
serverEndpoint
;
}
// The server endpoint can be partially defined in the variable 'serverPort'.
// In that case, the own IP address is used.
// It is necessary in case of a remote client because this endpoint is passed to the server responder to contact the client for its response.
// In future implementation of requester/responder this may not be necessary.
String
serverPort
=
getStringOrNothingAtAll
(
"serverPort"
);
// Default value for port.
if
(
serverPort
==
null
)
{
serverPort
=
"7000"
;
}
try
{
serverEndpoint
=
"tcp://"
+
InetAddress
.
getLocalHost
().
getHostAddress
()
+
":"
+
serverPort
;
System
.
out
.
println
(
"================> serverEndPoint "
+
serverEndpoint
);
return
serverEndpoint
;
}
catch
(
UnknownHostException
e
)
{
}
return
"tcp://localhost:7000"
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment