logo elektroda
logo elektroda
X
logo elektroda

How to manage the WIZnet W5100 buffer at the HTTP client-server on the Arduino?

strikexp 1314 2
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 15369852
    strikexp
    Level 27  
    I am making an HTTP client-server using an Arduino and the mentioned WIZnet W5100 chip. In relation to this, I would like to solve the problem of collisions when receiving. Because although HTTP is a one-way protocol, the client waits for a response from the server. So I am wondering how to receive this data in case I send something from the Arduino. And at the same time not to disable the server on the Arduino.
    In the WIZnet documentation I found this phrase "Internal 16Kbytes Memory for Tx/Rx Buffers". Does this mean that both input and output data are stored in a buffer of 16kb each?
    In fact, that's the amount of space I'm sure I won't exceed in 1 second. And if that data is held there then all I have to do is wait long enough and check what came in.
    I'm just wondering what such a combined response from the server and request will look like. Divided into fragments or merged into one coherent sequence.

    Has anyone perhaps done similar things on this WIZnet W5100 chip?
  • ADVERTISEMENT
  • Helpful post
    #2 15369952
    michalko12
    MCUs specialist
    Read the datasheet of the W5100 to find out what the buffer is used for, and it would be useful to have a little knowledge of TCP, because without this it will be difficult to understand how the circuit works.

    The W5100 has one 16kB buffer, which is divided into smaller parts. There must be 2 buffers allocated to each of the 4 sockets on the W5100, one for packets received and one for packets sent. One packet can be up to 1500B in length. Count it all up and you will have the problem solved.

    Added after 4 [minutes]:

    strikexp wrote:
    As a matter of fact, that's the amount of space I'm sure I won't exceed in 1 second. And if the data is held there then I just have to wait long enough to see what came in.
    I'm just wondering what such a combined response from the server and request will look like. Divided into fragments or merged into one coherent string.

    You are demanding too much, log off from within Arduino.
    A data packet of max. about 1400B arrives, which you have to download from the W5100 and you wait for the next one. You have to collect the data in your processor.
  • #3 15370019
    strikexp
    Level 27  
    That is, it uses 4 sockets and a single buffer is 1500 bytes. I suppose I should read this, but I'm using a ready-made library from Arduino. And since I work as an object-oriented programmer, I know that making something from scratch is 10 times more expensive.

    So I understand that the ready-made Arduino library is the proverbial pain in the 4 letters here. Because there is no direct socket support. After which it would be easy to distinguish between response and request packets arriving at the same time.
ADVERTISEMENT