java zeroMq中文乱码 100
代码:privatestaticvoidpub()throwsInterruptedException{Contextcontext=ZMQ.context(1);Soc...
代码:
private static void pub() throws InterruptedException{
Context context = ZMQ.context(1);
Socket subscriber = context.socket(ZMQ.SUB);
subscriber.connect("tcp://xxx.xxx.xxx.xxx:18121");
subscriber.subscribe("".getBytes());
for (int i=0;i<100;i++) {
//Receive a message.
String string =null;
string = new String(subscriber.recv(0));
System.out.println("recv :" + string);
}
subscriber.close();
context.term();
}
打印出来的string中文乱码,请大神指教,不胜感激 展开
private static void pub() throws InterruptedException{
Context context = ZMQ.context(1);
Socket subscriber = context.socket(ZMQ.SUB);
subscriber.connect("tcp://xxx.xxx.xxx.xxx:18121");
subscriber.subscribe("".getBytes());
for (int i=0;i<100;i++) {
//Receive a message.
String string =null;
string = new String(subscriber.recv(0));
System.out.println("recv :" + string);
}
subscriber.close();
context.term();
}
打印出来的string中文乱码,请大神指教,不胜感激 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询