Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Californium (Cf) CoAP Framework » POST responses(Californium not sending payloads on responses)
icon5.gif  POST responses [message #1712746] Tue, 27 October 2015 20:59 Go to next message
Kerry Calvert is currently offline Kerry CalvertFriend
Messages: 2
Registered: October 2015
Junior Member
I have this simple class attached to a CoAP servers resource tree:

private class NSC_RegisterGw extends CoapResource {
private NSC_RegisterGw() {
super("RegisterGw");
// set display name
getAttributes().setTitle("Gateway RegisterGw");
}
@Override
public void handlePOST(CoapExchange exchange) {
exchange.respond(ResponseCode.CHANGED, "Foobar");
}
}

When my client device sends a CoAP message that maps to this handler, I send the canned response. I see the message emitted, but the payload is always truncated to 0 bytes.

I looked in the Californium.properties file and reset UDP_CONNECTOR_RECEIVE_BUFFER and UDP_CONNECTOR_SEND_BUFFER to 1024 but this has no effect.

I see no signs of error on the eclipse console.

When I step through the code with the debugger, everthing looks ok so the code gets to the point where it is invoking the interface function to actually send the response object it creates.

What I am doing seems straight forward, but nothing I screw around with will actually get the payload into the outbound packet.

Any suggestions?
Re: POST responses [message #1712826 is a reply to message #1712746] Wed, 28 October 2015 14:54 Go to previous message
Kerry Calvert is currently offline Kerry CalvertFriend
Messages: 2
Registered: October 2015
Junior Member
I found the problem to be that the Block Number parameter in the CoAP header sent by the client was set to 1. This confused Californium into thinking that a block response was needed so it sends an empty message for Block 1 for the response to the POST, since the response itself is small enough to fit in Block 0.
Previous Topic:client observe
Next Topic:Using CoAP to control master-slave structure
Goto Forum:
  


Current Time: Fri Sep 21 13:44:00 GMT 2018

Powered by FUDForum. Page generated in 0.03662 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top