GithubHelp home page GithubHelp logo

vibe-modbus's Introduction

vibe-modbus's People

Contributors

kubo39 avatar

Watchers

James Cloos avatar  avatar  avatar

vibe-modbus's Issues

Handling SIGPIPE?

Phobos's std.socket uses SO_NOSIGPIPE and MSG_NOSIGNAL flag to disable sending socket, which vibe-core/eventcore doesn't.

Performance

  • call recv(2)/send(2) twice or more.
  • call malloc(3) some times every request/response.
  • encode/decode is not optimized well.

Better handling response in clinet side

It is strange that client raises exception when receives error response...

    ReadHoldingRegistersResponse readHoldingRegisters(ushort startingAddress, ushort quantity)
    {
        ubyte[] data = new ubyte[4];
        size_t index = 0;
        data.write!(ushort, Endian.bigEndian)(startingAddress, &index);
        assert(index == 2);
        data.write!(ushort, Endian.bigEndian)(quantity, &index);
        assert(index == 4);
        auto length = cast(short)(1 + 1 + data.length);
        auto req = Request(MBAPHeader(0, PROTOCOL_ID, length, 0),
                           ProtocolDataUnit(FunctionCode.ReadHoldingRegisters, data));
        auto res =request(req);

        checkResponse(res, FunctionCode.ReadHoldingRegisters); // raise exception!!!

        ubyte byteCount = res.pdu.data.read!(ubyte, Endian.bigEndian);
        ushort[] registerValue = res.pdu.data.chunks(2)
            .map!(a => a.read!(ushort, Endian.bigEndian))
            .array;
        return ReadHoldingRegistersResponse(res.header, res.pdu.functionCode,
                                            byteCount, registerValue);
    }

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.