You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good morning, I have been working on getting a blockwise transfer working as part of a POST request.
I effectively have a large amount of data I want to send, I want the Java CoAP library to handle the block transfer, and once done have it unblock from the future to be able to obtain the fully reassembled payload.
I have been struggling to get this right, so far this is the code I have going:
/*** Grab a hold of the resource as a target for our POST.* * Then pack into the request our DLMS xAPDU with the* DLMS content type.* * Then also set the headers:*/StringuriHostStr = (this.remoteHost.getAddress()+":"+this.remoteHost.getPort()).replace("/", "");
log.warning("Computed URI host string: '"+uriHostStr+"'");
CoapRequestTargetresourceTarget = this.client.resource(this.resourcePath)
.payload(payloadToSend, this.contentType)
.con()
.host(uriHostStr)
.token(getAToken());
// .query("");// Pack the headers inresourceTarget = packHeaderOptions(resourceTarget);
log.finer("POST to be sent: '"+resourceTarget+"'");
// Now POST it and wait for it to completeCompletableFuture<CoapPacket> postFuture = resourceTarget.post();
// Wait for the response Coap packetCoapPacketpostResp = postFuture.get();
log.finer("Post response: '"+postResp+"'");
byte[] responsePayload = postResp.getPayload();
log.info("Post payload: '"+Arrays.toString(responsePayload)+"'");
How could I go about this? (Below is attached one of the ways I need to accomplish this)
The text was updated successfully, but these errors were encountered:
Good morning, I have been working on getting a blockwise transfer working as part of a POST request.
I effectively have a large amount of data I want to send, I want the Java CoAP library to handle the block transfer, and once done have it unblock from the future to be able to obtain the fully reassembled payload.
I have been struggling to get this right, so far this is the code I have going:
How could I go about this? (Below is attached one of the ways I need to accomplish this)
The text was updated successfully, but these errors were encountered: