gpt4 book ai didi

org.zeromq.ZMsg.pop()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 21:46:49 27 4
gpt4 key购买 nike

本文整理了Java中org.zeromq.ZMsg.pop()方法的一些代码示例,展示了ZMsg.pop()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZMsg.pop()方法的具体详情如下:
包路径:org.zeromq.ZMsg
类名称:ZMsg
方法名:pop

ZMsg.pop介绍

[英]Pop a ZFrame and return the toString() representation of it.
[中]弹出一个ZFrame并返回它的toString()表示形式。

代码示例

代码示例来源:origin: kawasima/enkan

@Override
public String recv(long timeout) {
  ZMsg msg = ZMsg.recvMsg(socket);
  clientAddress = msg.pop();
  return msg.popString();
}

代码示例来源:origin: org.zeromq/jeromq

public boolean sendMessage(ZMsg message)
{
  ZFrame frame = message.pop();
  boolean rc = false;
  while (frame != null) {
    rc = sendFrame(frame, !message.isEmpty() ? ZMQ.ZMQ_MORE : 0);
    if (!rc) {
      break;
    }
    frame = message.pop();
  }
  return rc;
}

代码示例来源:origin: org.zeromq/jeromq

ZFrame frame = request.pop();
byte[] clientPublicKey = frame.getData();
username = null;

代码示例来源:origin: org.zeromq/jeromq

/**
 * Pop a ZFrame and return the toString() representation of it.
 *
 * @return toString version of pop'ed frame, or null if no frame exists.
 */
public String popString()
{
  ZFrame frame = pop();
  if (frame == null) {
    return null;
  }
  return frame.toString();
}

代码示例来源:origin: kawasima/enkan

@Override
public void run() {
  while(!Thread.currentThread().isInterrupted()) {
    ZMsg msg = ZMsg.recvMsg(socket);
    ZFrame clientAddress = msg.pop();
    String input = msg.popString();
    int cursor = Integer.parseInt(msg.popString());
    int[] anchor = {-1};
    ZMsg reply = new ZMsg();
    reply.add(clientAddress.duplicate());
    String trimmedCommand = input.trim();
    if (trimmedCommand.startsWith("/")) {
      if (!trimmedCommand.contains(" ")) {
        Predicate<String> filter = trimmedCommand.equals("/") ?
            n -> true : n -> n.startsWith(trimmedCommand.substring(1));
        commandNames.stream()
            .filter(filter)
            .forEach(s -> reply.add("/" + s));
        anchor[0] = 0;
      }
    }
    reply.send(socket, true);
  }
}

代码示例来源:origin: org.zeromq/jeromq

/**
 * Pop frame off front of message, caller now owns frame.
 * If next frame is empty, pops and destroys that empty frame
 * (e.g. useful when unwrapping ROUTER socket envelopes)
 * @return
 *          Unwrapped frame
 */
public ZFrame unwrap()
{
  if (size() == 0) {
    return null;
  }
  ZFrame f = pop();
  ZFrame empty = getFirst();
  if (empty.hasData() && empty.size() == 0) {
    empty = pop();
    empty.destroy();
  }
  return f;
}

代码示例来源:origin: net.unit8.enkan/enkan-repl-pseudo

@Override
public void run() {
  while(!Thread.currentThread().isInterrupted()) {
    ZMsg msg = ZMsg.recvMsg(socket);
    ZFrame clientAddress = msg.pop();
    String input = msg.popString();
    int cursor = Integer.parseInt(msg.popString());
    int[] anchor = {-1};
    ZMsg reply = new ZMsg();
    reply.add(clientAddress.duplicate());
    String trimmedCommand = input.trim();
    if (trimmedCommand.startsWith("/")) {
      if (!trimmedCommand.contains(" ")) {
        Predicate<String> filter = trimmedCommand.equals("/") ?
            n -> true : n -> n.startsWith(trimmedCommand.substring(1));
        commandNames.stream()
            .filter(filter)
            .forEach(s -> reply.add("/" + s));
        anchor[0] = 0;
      }
    }
    reply.send(socket, true);
  }
}

代码示例来源:origin: kawasima/enkan

ReplResponse completerRes = fressian.read(completerMsg.pop().getData(), ReplResponse.class);
String completerPort = completerRes.getOut();
if (completerPort != null && completerPort.matches("\\d+")) {
    try {
      ZMsg msg = ZMsg.recvMsg(this.socket);
      ReplResponse res = fressian.read(msg.pop().getData(), ReplResponse.class);
      if (res.getOut() != null) {
        console.println(res.getOut());

代码示例来源:origin: net.unit8.enkan/enkan-repl-jshell

while(!Thread.currentThread().isInterrupted()) {
  ZMsg msg = ZMsg.recvMsg(socket);
  ZFrame clientAddress = msg.pop();
  String input = msg.popString();
  int cursor = Integer.parseInt(msg.popString());

代码示例来源:origin: net.unit8.enkan/enkan-repl-jshell

ZFrame clientAddress = msg.pop();
ZmqServerTransport transport = ioProxy.listen(server, clientAddress);

代码示例来源:origin: net.unit8.enkan/enkan-repl-pseudo

ZFrame clientAddress = msg.pop();
ZmqServerTransport transport = new ZmqServerTransport(server, clientAddress);
String[] cmd = msg.popString().trim().split("\\s+");

代码示例来源:origin: kawasima/enkan

ZFrame clientAddress = msg.pop();
ZmqServerTransport transport = new ZmqServerTransport(server, clientAddress);
String[] cmd = msg.popString().trim().split("\\s+");

代码示例来源:origin: org.projectreactor/reactor-net

@Override
  public int handle(ZLoop loop, ZMQ.PollItem item, Object arg) {
    ZMsg msg = ZMsg.recvMsg(socket);
    if (null == msg || msg.size() == 0) {
      return 0;
    }
    if (closed) {
      return -1;
    }
    String connId;
    switch (ZeroMQWorker.this.socketType) {
      case ZMQ.ROUTER:
        connId = msg.popString();
        break;
      default:
        connId = ZeroMQWorker.this.id.toString();
    }
    ZeroMQNetChannel<IN, OUT> netChannel = select(connId)
        .setConnectionId(connId)
        .setSocket(socket);
    ZFrame content;
    while (null != (content = msg.pop())) {
      netChannel.read(Buffer.wrap(content.getData()));
    }
    msg.destroy();
    return 0;
  }
};

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com