我正在尝试使用 LiveTribe SLP 模块 (http://livetribe.codehaus.org/LiveTribe-SLP) 为应用程序提供 SLP 服务。我想将端口从 427 完全更改为其他端口。文档很少,更令人困惑的是,在常见问题解答中,它声称链接到一个示例,该示例可以准确地显示我正在寻找的内容。不幸的是,它没有(除非我忽略了什么)。有谁知道如何做到这一点?
最佳答案
这里有一个客户端和服务器的例子:
http://livetribe.org/SLP-Examples-JMX 罢工>
(链接断开。)
这些是服务器端的重要行:
// Allow this code to be run by non-root users on Linux/Unix
Settings settings = new MapSettings();
settings.put(Keys.PORT_KEY, 4427);
// Create the SLP ServiceAgent that advertises the JMX service
ServiceAgent serviceAgent = SLP.newServiceAgent(settings);
在客户端:
// Allow this code to be run by non-root users on Linux/Unix
Settings settings = new MapSettings();
settings.put(Keys.PORT_KEY, 4427);
// Create the SLP UserAgentClient that discovers services
UserAgentClient userAgentClient = SLP.newUserAgentClient(settings);
关于java - 如何更改用于 livetribe SLP 的端口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10014385/