这是我的CoAP客户端代码,用于发送增量有效负载大小的请求:
CoapClient client = new CoapClient(uri);
for (int payloadSize = start; payloadSize <= end; payloadSize += stepSize) {
for (int repeatCount = 0; repeatCount < repeatNo; repeatCount++) {
//building payload
StringBuilder sb = new StringBuilder();
for (int i = 0; i< payloadSize ; i ++)
sb.append("a");
//building request with payload
Request req = new Request(CoAP.Code.GET);
req.setPayload(sb.toString().getBytes());
//sending request
long sendTime = System.currentTimeMillis();
CoapResponse response = client.advanced(req);
long receiveTime = System.currentTimeMillis();
long transmissionTime = receiveTime - sendTime;
...
但是,似乎客户端没有发生UDP数据报碎片或CoAP块传输。我做错了什么?
在我的本地计算机中,传输的最大有效负载大约为2300(小于2400)字节。在互联网上大约1400(不到1500)。
我想从CoAP客户端向CoAP服务器发送大量请求。我究竟做错了什么? (具体到Californium CoAP实施请。)
感谢。