代码
try {
$stomp = new Stomp('tcp://xx:xxx:xxx:xxx:61616','admin','admin');
// connection to remote server
} catch(StompException $e) {
die('Connection failed: ' . $e->getMessage());
}
结果
Connection failed: Server is not responding
上面的代码适用于
localhost
或内联网,但不适用于外部IP。
使用 java 代码连接到同一服务器可以工作,但使用 PHP STOMP 时则不行。
通常,端口 61616 是代理的 OpenWire 端口,因此 STOMP 客户端将无法连接到它。如果您已将其配置为 STOMP,但仍然无法从本地网络外部访问它,则可能是防火墙问题或某些其他网络策略抑制了客户端的访问能力。由于我们不知道您的配置或网络拓扑,因此您的管理之外的任何人都无能为力。