我收到以下错误
线程“主”org.zeromq.ZMQException 中的异常:Errno 48:org.zeromq.ZMQ$Socket.mayRaise(ZMQ.java:3533) 的地址已在 org.zeromq.ZMQ$Socket.bind(ZMQ.java :2987) 在 com.zmq.pub_sub.Publisher.main(Publisher.java:16)
这是我的发布者类:
public class Publisher {
public static void main(String[] args) throws Exception
{
// Prepare our context and Publisher
try (ZContext context = new ZContext()) {
ZMQ.Socket publisher = context.createSocket(SocketType.PUB);
publisher.bind("tcp://140.93.0.95:5678");
int id = 1;
String msg = "";
while (true){
Thread.sleep(1000);
msg = "topic1- msg"+id ;
publisher.send(msg);
id++;
}
}
}
}
PS:我想在两台远程机器之间使用 ZMQ