Giter Site home page Giter Site logo

Comments (6)

dresende avatar dresende commented on May 27, 2024

Yes, the reply assumes a first (fixed) argument for an error, and then the remaining arguments depend on the function code and what the standard defines for a response.

from stream.

jacobq avatar jacobq commented on May 27, 2024

Yes, the reply assumes a first (fixed) argument for an error, and then the remaining arguments depend on the function code and what the standard defines for a response.

OK, thank you for clarifying that. Is it the same regardless of whether reply is obtained from a specific event like read-coils vs. from the lower level request event?

connection.on("request", (request, reply) => {
    // ...
});
connection.on("read-coils", (request, reply) => {
    // ...
    // does this `reply` have the same signature/contract as the one above?
});

from stream.

dresende avatar dresende commented on May 27, 2024

Is it the same regardless of whether reply is obtained from a specific event like read-coils vs. from the lower level request event?

I believe yes. But perhaps, in that case, it makes more sense to be able to send a raw response. You could just ignore the reply and write a response yourself, but it would be easier.

from stream.

jacobq avatar jacobq commented on May 27, 2024

OK, thanks for the reply. I will plan to just keep using the request event and it's reply function as I have it (like above -- seems to be working OK). It just feels a little non-intuitive because the library code does some of the protocol work (e.g. ID & function code / exception code) but not all of it (e.g. start address & number of coils/registers), so I have to dig into the library code to see what I need to do. For example, should I be sending "one big buffer" or separate arguments for, say, start address and array of data.

You could just ignore the reply and write a response yourself

Would that look something like this: transport.write(<Buffer>)? (Where <Buffer> holds the "Protocol Data Unit (PDU)")

from stream.

dresende avatar dresende commented on May 27, 2024

Yes.

from stream.

jacobq avatar jacobq commented on May 27, 2024

Closing due to inactivity

from stream.

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.