Giter Club home page Giter Club logo

Comments (4)

jcw avatar jcw commented on July 20, 2024

This is not possible - the code only supports single-packet sends in its original design, but there is a patch by Andrew Lindsay to handle incoming MP3 streams, which would indicate that multi-packet receives might be possible through a suitably modified version of the EtherCard library. Try googling for "thiseldo" and "mp3".

from ethercard.

thiseldo avatar thiseldo commented on July 20, 2024

Looking at the code, it seems that the file tcpip.cpp, line 622 - 623 has a comment to say:

  // Comment out to enable large files, e.g. mp3 streams to be downloaded

// tcp_client_statete = 4;

however this is commented out in the library and also looks like it should be 'tcp_client_state' not 'tcp_client_statete'.
For normal operation this should be present, to allow large files to be received it should be commented out, e.g. if receiving a stream from a server.

I think this however is different to what you are asking, server push is different to client get, which this change allows.

JCW - I think the line needs to be uncommented and corrected otherwise you could be seeing issues with connections being kept open.

Thanks

Andy
(from a tent in France!)

from ethercard.

alexiskattan avatar alexiskattan commented on July 20, 2024

Jean-Claude, thanks for the information.

Andy, you are right, I am asking about having the server to ping the device every so often in order to get a sensor reading as opposed to having to have the device constantly pinging the server. I understand that there are other firewall/keep-alive issue with this change but that is OK.

To follow up on your comment. If I uncomment line 623 (and fix the typo), this will allow the connection to go into "State 4" and prevent it from going to "State 5", which I think is "closed". Are there any other modifications that will be needed? Will the device then keep the connection open until the server closes it or the firewall closes the connection?

Also, I'm trying to figure out what the different states are. My current hypothesis is:

State 1: Unconnected
State 2: Handshake established
State 3: Transmitting
State 4: Keep-alive
State 5: Closed

Thanks again for the information you guys. Also, this library has been wonderful and very easy to get started with. Thank you!

from ethercard.

alexiskattan avatar alexiskattan commented on July 20, 2024

@thiseldo Thanks again for the tip. I'm exploring it more now but am a little confused about what I have to do on the server side to trigger the code into that state 4. The tools I'm using are node.js and chunked transfer encoding.

My understanding so far is that packetLoop gets a packet. Then it is looking at the packet to make sure it is larger than a certain size. My confusion comes with line 607,

len = (*client_tcp_datafill_cb)((gPB[TCP_SRC_PORT_L_P]>>5)&0x7);

I can't figure out what it is trying to do. It seems like if I can get this to be >0 I will pass the if statement on line 621 ,

if (tcp_client_state==3 && len>0) { 
  // Comment out to enable large files, e.g. mp3 streams to be downloaded
    tcp_client_state = 4;

which will keep the connection open.

What does the server have to respond in order for it to get into this area of the code?

from ethercard.

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.