Code Monkey home page Code Monkey logo

Comments (5)

sophokles73 avatar sophokles73 commented on May 18, 2024

So far there is no support for transferring streams of data in Californium. You can either read in all data into memory and let Californium do the chunking or you need to implement the chunking yourself, which you seem to have opted for.
However, since I am not very knowledgable about the blockwise code in Californium this should probably be answered by @mkovatsc

from californium.

kiemlicz avatar kiemlicz commented on May 18, 2024

Thank you,
I've done chunking by myself but it ends with aforementioned NPE in BlockwiseLayer (on receiving response)

from californium.

mkovatsc avatar mkovatsc commented on May 18, 2024

The original idea was to leave out the BlockwiseLayer, when you want to handle Blockwise Transfers manually. However, the stack wasn't tested in such a configuration recently. Maybe you can give it a try and tell us what happens...

I also explained another possible strategy here https://dev.eclipse.org/mhonarc/lists/cf-dev/msg00654.html:
If someone needs to mix resources with "normal blockwise transfers" and streaming resources, one could implement a flag that let's BlockwiseLayer pass all messages untouched, so that the resource handler can implement block handling.

from californium.

wiinguyen avatar wiinguyen commented on May 18, 2024

Please advise if this is a way to turn off BlockWiseLayer

$ git diff californium-core/src/main/java/org/eclipse/californium/core/network/stack/CoapStack.java
diff --git a/californium-core/src/main/java/org/eclipse/californium/core/network/stack/CoapStack.java b/californium-core/src/main/java/org/ecli
index 13658e1..6bfab37 100644
--- a/californium-core/src/main/java/org/eclipse/californium/core/network/stack/CoapStack.java
+++ b/californium-core/src/main/java/org/eclipse/californium/core/network/stack/CoapStack.java
@@ -105,7 +105,7 @@ public class CoapStack {
new Layer.TopDownBuilder()
.add(top)
.add(new ObserveLayer(config))

  •                           .add(new BlockwiseLayer(config))
    
  •                           //.add(new BlockwiseLayer(config))
                            .add(reliabilityLayer)
                            .add(bottom = new StackBottomAdapter())
                            .create();
    

$git diff californium-core/src/main/java/org/eclipse/californium/core/network/Matcher.java
diff --git a/californium-core/src/main/java/org/eclipse/californium/core/network/Matcher.java b/californium-core/src/main/java/org/eclipse/cali
index 44dfe9b..618c091 100644
--- a/californium-core/src/main/java/org/eclipse/californium/core/network/Matcher.java
+++ b/californium-core/src/main/java/org/eclipse/californium/core/network/Matcher.java
@@ -517,7 +517,7 @@ public class Matcher {
}

                            Request request = exchange.getCurrentRequest();
  •                           if (request != null && (request.getOptions().hasBlock1() || response.getOptions().hasBlock2()) ) {
    
  •                           if (request != null && response != null && (request.getOptions().hasBlock1() || response.getOptions().hasBlock2
                                    KeyUri uriKey = new KeyUri(request.getURI(), request.getSource().getAddress(), request.getSourcePort())
                                    LOGGER.log(Level.FINE, "Remote ongoing completed, cleaning up ", uriKey);
                                    ongoingExchanges.remove(uriKey);
    

BTW, "response != null" check is needed. Otherwise, it'll crash.

from californium.

sophokles73 avatar sophokles73 commented on May 18, 2024

@kiemlicz,

we are trying to close out outstanding issues for the next release. We have put a lot of work into the BlockwiseLayer on the 2.0.x branch. FMPOV it should be possible to do a manual blockwise transfer based on this work (using either master or 2.0.x). This work will not find its way into the 1.0.x branch though. I strongly advise to update to 2.0.x in order to take advantage of all other improvements we have been working on as well.

Closing this as won't fix.

from californium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.