org.eclipse.californium.core.coap.Response.setDestination()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(93)

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

Response.setDestination介绍

暂无

代码示例

代码示例来源:origin: eclipse/californium

/**
 * Sends the specified response over the same endpoint as the request has
 * arrived.
 * 
 * @param response the response
 */
public void sendResponse(Response response) {
  response.setDestination(request.getSource());
  response.setDestinationPort(request.getSourcePort());
  setResponse(response);
  endpoint.sendResponse(this, response);
}

代码示例来源:origin: org.eclipse.californium/californium-core

/**
 * Sends the specified response over the same endpoint as the request has
 * arrived.
 * 
 * @param response the response
 */
public void sendResponse(Response response) {
  response.setDestination(request.getSource());
  response.setDestinationPort(request.getSourcePort());
  setResponse(response);
  endpoint.sendResponse(this, response);
}

代码示例来源:origin: eclipse/californium

/**
 * Creates a response to the specified request with the specified response
 * code. The destination address of the response is the source address of
 * the request.
 * Type and MID are usually set automatically by the {@link ReliabilityLayer}.
 * The token is set automatically by the {@link Matcher}.
 *
 * @param request
 *            the request
 * @param code
 *            the code
 * @return the response
 */
public static Response createResponse(Request request, ResponseCode code) {
  Response response = new Response(code);
  response.setDestination(request.getSource());
  response.setDestinationPort(request.getSourcePort());
  return response;
}

代码示例来源:origin: org.eclipse.californium/californium-core

/**
 * Creates a response to the specified request with the specified response
 * code. The destination address of the response is the source address of
 * the request.
 * Type and MID are usually set automatically by the {@link ReliabilityLayer}.
 * The token is set automatically by the {@link Matcher}.
 *
 * @param request
 *            the request
 * @param code
 *            the code
 * @return the response
 */
public static Response createResponse(Request request, ResponseCode code) {
  Response response = new Response(code);
  response.setDestination(request.getSource());
  response.setDestinationPort(request.getSourcePort());
  return response;
}

代码示例来源:origin: eclipse/californium

@Override
  public void go() {
    Response response = new Response(code);
    if (destination != null) {
      response.setDestination(destination.getAddress());
      response.setDestinationPort(destination.getPort());
    }
    setProperties(response);
    RawData raw = serializer.serializeResponse(response);
    send(raw);
  }
}

代码示例来源:origin: eclipse/californium

private static Response responseFor(final Request request) {
    Response response = new Response(ResponseCode.CONTENT);
    response.setMID(request.getMID());
    response.setToken(request.getToken());
    response.setBytes(new byte[]{});
    response.setSource(request.getDestination());
    response.setSourcePort(request.getDestinationPort());
    response.setDestination(request.getSource());
    response.setDestinationPort(request.getSourcePort());
    return response;
  }
}

代码示例来源:origin: eclipse/californium

private Response responseFor(final Request request) {
    Response response = new Response(ResponseCode.CONTENT);
    response.setMID(request.getMID());
    response.setToken(request.getToken());
    response.setBytes(new byte[]{});
    response.setSource(request.getDestination());
    response.setSourcePort(request.getDestinationPort());
    response.setDestination(request.getSource());
    response.setDestinationPort(request.getSourcePort());
    return response;
  }
}

代码示例来源:origin: org.eclipse.californium/californium-core

} else {
  block = new Response(response.getCode());
  block.setDestination(response.getDestination());
  block.setDestinationPort(response.getDestinationPort());
  block.setOptions(new OptionSet(response.getOptions()));

代码示例来源:origin: eclipse/californium

} else {
  block = new Response(response.getCode());
  block.setDestination(response.getDestination());
  block.setDestinationPort(response.getDestinationPort());
  block.setOptions(new OptionSet(response.getOptions()));

相关文章