Giter Site home page Giter Site logo

Comments (4)

MathiasKoch avatar MathiasKoch commented on June 29, 2024

After starting to implement it, i guess it makes a bit sense if its the comment being off.
I guess open, would actually just allocate the socket handle and set the mode flag? eq. of eg. AT+USOCR.

from embedded-nal.

MathiasKoch avatar MathiasKoch commented on June 29, 2024

How would you with this interface open and connect to at TCP remote?

As far as i see it, it is missing a reference between open and connect?
To me it seems like connect is missing an argument referring to the TcpSocket returned by open()?

Also i am not sure how one would implement this trait on any devices, when open and connect does not hold a reference to self, possibly even mutably. I don't think you would be able to open or connect to a socket over any bus (Serial, SPI, I2C) without a mutable self reference? And following that thought i think all the functions should have that &mut self, in order to communicate with the hardware peripherals it owns?

from embedded-nal.

thejpster avatar thejpster commented on June 29, 2024

My understanding of Berkley sockets is that open() creates the socket (so you have a file descriptor) but it is in the "unconnected" state until you call connect(fd, sock_addr, sock_addr_len). I've now fixed the comment for TcpStack::open.

You are right, the trait functions need a self or mut self reference. I think self is the right place to start, otherwise you can't share the stack between multiple distinct things (like an HTTP client and a Telnet client). The stack implementation will need to have some internal mutex to hold its state.

from embedded-nal.

thejpster avatar thejpster commented on June 29, 2024

Thanks for the issue by the way. I hope this simple crate is at least thought-provoking, and maybe even somehow useful.

from embedded-nal.

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.