Hello all,
I’m trying to use Californium to discover CoAP Devices on an IPv6 Network. I am able to send multicast commands via IP ff02::1. The devices each respond in turn:
22:50:08.262157 IP6 fe80::290:e8ff:fe53:37a7.37269 > ip6-allnodes.5683: UDP, length 24
22:50:08.276986 IP6 fe80::5610:ecff:fe1c:2038.5683 > fe80::290:e8ff:fe53:37a7.37269: UDP, length 180
22:50:08.277071 IP6 fe80::5610:ecff:fe1c:2030.5683 > fe80::290:e8ff:fe53:37a7.37269: UDP, length 180
22:50:08.277097 IP6 fe80::5610:ecff:fe1c:1fe7.5683 > fe80::290:e8ff:fe53:37a7.37269: UDP, length 180
Unfortunately, it seems that Californium is matching the responses to the request at a 1:1 ratio and dumping the remaining responses…
10 FINE [Matcher]: Closed open request with KeyMID[54042 for null:0] - (org.eclipse.californium.core.network.Matcher.java:342) receiveResponse() in thread Thread-3 at (2017-01-26 22:53:45)
10 FINEST [ReliabilityLayer]: Cancel any retransmission - (org.eclipse.californium.core.network.stack.ReliabilityLayer.java:251) receiveResponse() in thread Thread-3 at (2017-01-26 22:53:45)
GOT RESPONSE!!!! ACK-2.05 MID=54042, Token=93be4f31377632ed, OptionSet={"Content-Format":"application/json"},
10 INFO [Matcher]: Ignoring unmatchable piggy-backed response from /fe80:0:0:0:5610:ecff:fe1c:2030%3:5683: ACK-2.05 MID=54042, Token=93be4f31377632ed, OptionSet={"Content-Format":"application/json"}, .. 165 bytes - (org.eclipse.californium.core.network.Matcher.java:363)
receiveResponse() in thread Thread-3 at (2017-01-26 22:53:45)
10 INFO [Matcher]: Ignoring unmatchable piggy-backed response from /fe80:0:0:0:5610:ecff:fe1c:1fe7%3:5683: ACK-2.05 MID=54042, Token=93be4f31377632ed, OptionSet={"Content-Format":"application/json"},.. 165 bytes - (org.eclipse.californium.core.network.Matcher.java:363)
receiveResponse() in thread Thread-3 at (2017-01-26 22:53:45)
Is there a way to properly configure the request to ensure that the multiple responses are delivered ?
I have tried many different iterations, starting with a simple CoapClient and async handler. Most recent implementation was attempting to use a Request, and waitForResponse to try to read the various responses.
Request req = Request.newGet();
req.setURI(path);
req.setMulticast(true);
req.setConfirmable(false);
try {
Response rep = req.send().waitForResponse(4000);
System.out.println("GOT RESPONSE!!!! " +rep.toString());
while ((rep = req.waitForResponse(4000)) != null)
{
System.out.println("GOT RESPONSE!!!! " +rep.toString());
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Thanks in advance. I look forward to your response.
Regards,
Robert