Code Monkey home page Code Monkey logo

Comments (6)

nothingmn avatar nothingmn commented on June 27, 2024

Yes, this stuff is definitely a work in progress! The whole Channel/Communication setup needs to be ironed out completely and tested fully....

from agent.contrib.

mr23 avatar mr23 commented on June 27, 2024

I'd also push the buffer out to the class level and preallocate it, for performance. Less GC and frag.

from agent.contrib.

mr23 avatar mr23 commented on June 27, 2024

Why close the issue if the code is still fragile/incomplete?

from agent.contrib.

nothingmn avatar nothingmn commented on June 27, 2024

Hit the wrong button.. :p

from agent.contrib.

nothingmn avatar nothingmn commented on June 27, 2024

This should do it...

    protected byte[] GetBytes(SerialPort port)
    {
        byte[] buffer = new byte[port.BytesToRead];
        port.Read(buffer, 0, buffer.Length);
        return buffer;
    }

seems simple enough..

what do you think?

from agent.contrib.

mr23 avatar mr23 commented on June 27, 2024

Could run out of memory quickly. Think 57.6k for example, 1+ seconds. Otherwise it is simply correct.
In my testing on the emulator, despite either timer polling or DataReceived, sometimes a stall occurred for a few seconds.
No doubt with an OS the AGENT may too.
Safer to use a limit, allowing User to tweak it.

Sent from my Kindle Fire


From: Rob Chartier [email protected]
Sent: Fri Jul 12 22:57:50 CST 2013
To: "nothingmn/AGENT.Contrib" [email protected]
Cc: Chris Meier [email protected]
Subject: Re: [AGENT.Contrib] BaseChannel/GetBytes, buffer overrun potential (#9)

This should do it...

protected byte[] GetBytes(SerialPort port) { byte[] buffer = new byte[port.BytesToRead]; port.Read(buffer, 0, buffer.Length); return buffer; }

seems simple enough..

what do you think?


Reply to this email directly or view it on GitHub.

from agent.contrib.

Related Issues (2)

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.