Giter VIP home page Giter VIP logo

Comments (3)

gralin avatar gralin commented on September 28, 2024 1

Hi @joproulx, thanks for sharing details with your issue. So far I only had segmentation in responses but BACnet supports also segmentation in requests, so your use case if valid.

Does this imply that segmentation on transmit is not supported? Or there is a different way to achieve this, that I don't see?

Unfortunately, based on my quick review, this codebase is not prepared to send requests in more than one frame. There are fragments that seem prepared for that:

BACnet/Serialize/APDU.cs

Lines 40 to 44 in 9a7e227

if ((type & BacnetPduTypes.SEGMENTED_MESSAGE) > 0)
{
buffer.buffer[buffer.offset++] = sequenceNumber;
buffer.buffer[buffer.offset++] = proposedWindowSize;
}

but BacnetPduTypes.SEGMENTED_MESSAGE is never set in case of sending confirmed service request.

If segmentation on transmit is not supported, what would be the best way to determine that my request is too big?

First of all, as a workaround, I suggest you split your request into two or more (asking for a subset of all the properties you need) and then combine the responses (I guess you know this but just in case anyone reading this doesn't).

I think currently you won't know your request is too big unless you try to send it (and fix the silent error).

If I were to send a PR to help fix the silent error, what would you suggest? Log an error in that case? Or let the exception bubble up?

Originally this codebase was in C/C++ and later was ported to C#. That's why you don't get exceptions in most places but rather result codes or boolean results. As a C# developer however, I would expect an exception to be thrown when I try to send something that can't be sent. I don't know however where would be the best place to determine it - you can suggest something.

from bacnet.

joproulx avatar joproulx commented on September 28, 2024

Ok thanks for the explanation @gralin. I split the ReadPropertyMultipleRequest as suggested and it works fine.

Originally this codebase was in C/C++ and later was ported to C#. That's why you don't get exceptions in most places but rather result codes or boolean results. As a C# developer however, I would expect an exception to be thrown when I try to send something that can't be sent. I don't know however where would be the best place to determine it - you can suggest something.

I see. your point. I would suggest to just avoid swallowing the exception and let it bubble up.
image

But again, this is not a critical issue since it doesn't really break any functionality.
Thanks again for your answer!

from bacnet.

gralin avatar gralin commented on September 28, 2024

Sure, I agree, I would only wrap the original exception with something more meaningful than OutOfRangeException, so that it's clear that you are trying to send too much data and since segmentation of requests is not implemented, this has failed. Feel free to submit a PR if you want to improve the codebase.

from bacnet.

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.